Subject: [xsl] last() breaks processing of context node list From: Mario Dix <madix@xxxxxxxx> Date: Tue, 26 Mar 2002 16:20:59 +0100 |
It looks to me that within template "seealso" every time the last()-function is called the position of the context node in the context node list is toggled to #3. The test case below is modelled after an example of Doug Tidwell's "XSLT" p.106. Is this a bug or a feature? Any help would be appreciated. Cheers, Mario ---------------------------------------------------- Environment: Linux >>>>>>> Xalan Version Xalan Java 2.2.D13, <<<<<<< j2re1.3.1 -- or -- Linux >>>>>>> Xalan Version Xalan Java 2.3.1, <<<<<<< j2re1.3.1 both xalan-versions same result ---------------------------------------- Result: ---------------------------------------- <html> <body>Behaviour Test of Function last() <p> <a name="id_1"></a>Headline_A DDD-A <a href="#id_5">Headline_E </a> See also: <a href="#id_2">1Headline_B 3</a>, <a href="#id_4">3Headline_D 3</a>, <a href="#id_4">3Headline_D 3</a>, <a href="#id_4">3Headline_D 3</a>, <a href="#id_4">3Headline_D 3</a>, <a href="#id_4">3Headline_D 3</a>, ..... --- and so forth --- ---------------------------------------- XML-Input: ---------------------------------------- <?xml version="1.0" ?> <!DOCTYPE AAA [ <!ELEMENT AAA (BBB+)> <!ELEMENT BBB (CCC,DDD+) > <!ELEMENT CCC (#PCDATA) > <!ATTLIST CCC id ID #REQUIRED > <!ELEMENT DDD (#PCDATA | xref | seealso)* > <!ELEMENT xref EMPTY > <!ATTLIST xref refid IDREF #REQUIRED > <!ELEMENT seealso EMPTY > <!ATTLIST seealso refids IDREFS #REQUIRED > ]> <AAA> <BBB> <CCC id="id_1">Headline_A </CCC> <DDD>DDD-A <xref refid="id_5"/> <seealso refids="id_3 id_2 id_4"/> </DDD> </BBB> <BBB> <CCC id="id_2">Headline_B </CCC> <DDD>DDD-B <xref refid="id_1"/> </DDD> </BBB> <BBB> <CCC id="id_3">Headline_C </CCC> <DDD>DDD-C <xref refid="id_1"/> </DDD> </BBB> <BBB> <CCC id="id_4">Headline_D </CCC> <DDD>DDD-D <xref refid="id_3"/> </DDD> </BBB> <BBB> <CCC id="id_5">Headline_E </CCC> <DDD>DDD-E <xref refid="id_4"/> </DDD> </BBB> </AAA> ---------------------------------------- XSL-Stylesheet ---------------------------------------- <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" /> <xsl:template match="/"> <xsl:apply-templates select="AAA"/> </xsl:template> <xsl:template match="AAA"> <html> <body> <xsl:text>Behaviour Test of Function last() </xsl:text> <xsl:apply-templates select="BBB"/> </body> </html> </xsl:template> <xsl:template match="BBB"> <p> <a name="{CCC/@id}"/> <xsl:value-of select="CCC"/> <xsl:apply-templates select="DDD"/> </p> </xsl:template> <xsl:template match="DDD"> <xsl:apply-templates select="*|text()"/> </xsl:template> <xsl:template match="xref"> <a href="#{@refid}"> <xsl:value-of select="id(@refid)"/> </a> </xsl:template> <xsl:template match="seealso"> <xsl:text>See also: </xsl:text> <xsl:for-each select="id(@refids)"> <a href="#{@id}"> <xsl:value-of select="position()"/> <xsl:value-of select="."/> <xsl:value-of select="last()"/> </a> <xsl:if test="not(position()=last())"> <xsl:text>, </xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> --------------------------------------------- -- Mario Dix XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How to get XSL transform , Michael Kay | Thread | [xsl] Dynamic XSL filtering using A, Amrit Gill |
RE: [xsl] How to get XSL transform , WATKIN-JONES,ADAM (H | Date | RE: [xsl] How to get XSL transform , WATKIN-JONES,ADAM (H |
Month |