Next in thread → Next in month →

Re: [docbook-apps] Cannot write xml:lang to content.opf

From
Bob Stayton <>
Date
2011-12-02T21:02:57+00:00
ID
026d01ccb135$c015a9d0$6600a8c0@pazu
Thread
Re: [docbook-apps] Cannot write xml:lang to content.opf
Hi Dave,

You are missing the context.  8^)

When that template is applied, the context is 
already the top-level book element, so the select statement is trying to select 
/book/book, which does not exist.

 

Also, you have put @xml:lang in the predicate, but 
you haven't actually selected its value.  Your current select says "apply 
templates to a book element that has an @xml:lang", which will process the 
whole <book> if it has the attribute.  It's a good thing it didn't 
work.  8^)

 

I would suggest the following:

 

<xsl:value-of select="/*/@xml:lang"/>

 

That will select the value of the top-level 
element's @xml:lang attribute.

 

If you only want to select if it has such an 
attribute, then qualify it with a predicate before selecting the 
attribute:

 

select="/*[@xml:lang]/@xml:lang"

 

 

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Xmplar 

  
To:  
  

  
Sent: Thursday, December 01, 2011 11:38 
  PM

  
Subject: [docbook-apps] Cannot write 
  xml:lang to content.opf

  

  X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4
  
   
   
   
   
   
   
   
   
   
   
   
  

  
I have specified an xml:lang value in a book element (i.e. 
  not within an info tag) and need to write that value to the content.opf 
  metadata element. 

  
Here is my customisation:

  
<xsl:element 
  namespace="http://purl.org/dc/elements/1.1/" name="dcterms:language">
                
  <xsl:apply-templates
                  
  select="d:book[@xml:lang]|d:article[@xml:lang]|d:part[@xml:lang]" />
              
  </xsl:element>

  
And all I get in content.opf is an empty element:

  
<dcterms:language 
  xmlns:dcterms="http://purl.org/dc/elements/1.1/" />

  
What am I missing from the element selection syntax? I'm 
  using 1.76.1, epub2. Thanks

  
  
  
  

  
-- 
Dave 
Gardiner
Next in thread → Next in month →