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

more xsl:number confusion!

Subject: more xsl:number confusion!
From: Jack Matheson <jack@xxxxxxxxxxxxxx>
Date: Tue, 27 Sep 2005 15:50:13 -0500
number confusion
I have the following input document:

<?xml version="1.0"?>
<a>
  <b/>
</a>

...and I am trying to determine why this stylesheet is not behaving as I would expect:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="a/b">
xsl:number result: (<xsl:number level="multiple" count="a" from="a"/>)
<xsl:variable name="S" select="."/>
<xsl:variable name="A" select="$S/ancestor-or-self::node()[local- name() = 'a']"/>
<xsl:variable name="F" select="$S/ancestor-or-self::node()[local- name() = 'a'][1]"/>
<xsl:variable name="AF" select="$A[count(.|$F) = count($F)]"/>
sequence number should contain: (<xsl:for-each select="$AF">
<xsl:value-of select="1 + count($AF/preceding-sibling::node() [local-name() = 'a'])"/>
<xsl:text> </xsl:text>
</xsl:for-each>)
</xsl:template>
</xsl:stylesheet>



I emit the result of an xsl:number when both the from and count patterns are the parent of the context node. The result is empty.
However, if I follow the explicit instructions on how to determine a sequence number, it seems like this should contain a single
integer of value 1.


The output I get from Xalan and Saxon both is:

xsl:number result: ()

sequence number should contain: (1 )

Can anyone help explain why the xsl:number value is not the same as the hand-computed value?

NOTE: I used a very simple local-name() test in place of a node-type and node-name test. I realize
this is not the same as matching the pattern "a", but it should suffice for this example.


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.