[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

last() breaks processing of context node list

Subject: last() breaks processing of context node list
From: Mario Dix <madix@xxxxxxxx>
Date: Tue, 26 Mar 2002 16:20:59 +0100
mario dix
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.