Hi,
I'm not understanding the context of this template.  I presume your input 
document has non-DocBook <jlistref> elements so the template matches on that 
element, right?  Then it generates DocBook <phrase> and <xref> elements.  Don't 
those appear in the FO and HTML outputs? That's what I would expect if this 
template appears in a DocBook XSL customization layer. Are you somehow 
subsequently processing these generated DocBook elements with additional 
templates?  Perhaps you can describe a bit more of how you are using this 
template.

In any case, there is an easier way to customize the text in cross references.  
Have you tried customizing the gentext string used in the stylesheet?  That 
process is described here:

http://www.sagehill.net/docbookxsl/CustomXrefs.html#XrefGentext

You would customize the @text attribute inside <l:template name="listitem"> in 
context <l:context name="xref">.  You would do this in your HTML customization 
layer and your PDF customization layer, using different text strings.

Bob Stayton
Sagehill Enterprises
[email protected]


  ----- Original Message ----- 
  From: Nancy Brandt 
  To: [email protected] 
  Sent: Wednesday, November 11, 2009 7:33 AM
  Subject: [docbook-apps] Customizing xref to a listitem


        Hi folks,




        I am trying to customize references to listitems as follows:




        <xsl:template match="jlistref">
        <phrase status="print">
        <xref>
        <xsl:copy-of select="@*"/>
        <xsl:attribute name="linkend">
        <xsl:copy-of select="@*"/>
        <xsl:value-of select="@ref"/>
        </xsl:attribute>

        <xsl:attribute name="xrefstyle">
        <xsl:value-of select="'template:Step&#160;%n on page %p'"/>
        </xsl:attribute>
        </xref>
        </phrase>

        <phrase status="html">
        <xref>
        <xsl:copy-of select="@*"/>
        <xsl:attribute name="linkend">
        <xsl:copy-of select="@*"/>
        <xsl:value-of select="@ref"/>
        </xsl:attribute>

        <xsl:attribute name="xrefstyle">
        <xsl:value-of select="'template:Step&#160;%n'"/>
        </xsl:attribute>
        </xref>
        </phrase>
        </xsl:template>





        So that when I compile a PDF, an xref will look like as follows:




        refer to Step <number> on page <number>.




        In HTML, though, it must be just: Step <number>




        However, the template above does not affect anything. The reference 
appears as default.




        Please, advise!




        Thanks a lot in advance!

        Nancy
         
       

Reply via email to