Next in thread → Next in month →

Re: [docbook-apps] Using a processing instruction to indicate customization URL

From
"Cob Rtayton"
Date
2006-10-03T15:44:26+00:00
ID
06a001c6e702$c706f2b0$6400a8c0@totoro
Thread
Re: [docbook-apps] Using a processing instruction to indicate customization URL
Well, I can help you with getting the stylesheet to 
read a processing instruction that appears before the root element.  The 
DocBook stylesheets have a match template on document root (match="/") that 
selects the first element for processing, and doesn't consider anything 
else.  This template in your customization layer will recognize your PIs at 
the root level, and then apply the original template:

 

<xsl:template match="/">
  
<xsl:apply-templates 
select="/processing-instruction('MyInstruction')"/>
  
<xsl:apply-imports/>
</xsl:template>

 

But I'm not sure what you are expecting the 
customization layer to do with the information.  In XSLT 1.0, there is no 
option for dynamic loading of stylesheet modules.  8^)

 

Bob Stayton
Sagehill Enterprises
DocBook Consulting


 

 

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

  
From: 
  Jerry 
  Janofsky 

  
To:  
  

  
Sent: Friday, September 29, 2006 1:15 
  PM

  
Subject: [docbook-apps] Using a 
  processing instruction to indicate customization URL

  

  

  
Hi,

  
 

  
I am new to DocBook 
  and XSLT.  I am using DocBook with DocBook XSL 
  1.69.1.

  
 

  
I want to use a 
  processing instruction in my DocBook XML to indicate the location of my 
  customization.xsl file. I was hoping it would look something 
  like:

  
 

  
<?xml 
  version="1.0"?>
<?MyInstruction CustomizationLayer=" 
  customization.xsl" 
  ?>
<book>   

  
  
   .

  
   
  .

  
   
  .

  
</book>

  
 

  
I would then write a 
  template to capture the value such as:

  
 

  
<xsl:template 
  match="processing-instruction(‘MyInstruction’)">
   “do 
  something here”
</xsl:template> 

  
 

  
However, I am unable 
  to capture “MyInstruction” at all. It does work if I put the processing 
  instruction in the “<chapter>” element, but this would be 
  inappropriate.

  
 

  
Can someone tell me 
  the proper way to handle this?

  
 

  
Jerry 
  J

  
Satuit 
  Systems
Next in thread → Next in month →