xsl-list
[Top] [All Lists]

Testing node immediately following in mixed content

2004-05-14 15:20:35
Hi all,

It may be that it is late Friday, but for the life of me, I cannot seem to
get the following template to output a comma when the node immediately
following the context node is a certain type.  Maybe my XPath is wrong?

I basically want to split "back-to-back" xref's with a comma (simulating
multiple footnote references). My output is HTML.

Sample xml (that needs comma seperation):

<para>Some filler text
        <xref linkend="burnc01-note-0001"/>
        <xref linkend="burnc01-note-0002"/>
completing the paragraph.</para>

Sample xml (that doesn't need a comma added)

<para>Some filler text
        <xref linkend="burnc02-note-0006"/> 
        some more filler text   
        <xref linkend="burnc02-note-0007"/>
</para>

Stylesheet snippet:

<xsl:template match="para">
        <p>
                <xsl:apply-templates/>
        </p>
</xsl:template>

<xsl:template match="xref">
        <a href="{concat('#',@linkend)}"><sup><xsl:value-of
select="number(substring-after(@linkend,'note-'))"/></sup></a>
        <xsl:if test="name(following-sibling::node()[1]) = 'xref'">
                <sup>,</sup>
        </xsl:if>
</xsl:template>

XmlSpy's xPath evaluator tells me that this is sound logic, but using Saxon,
I can't get the comma in the output.

Thanks,
Ryan


<Prev in Thread] Current Thread [Next in Thread>