Subject: Re: [xsl] preceding-sibling:: oddity|
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Jun 2012 17:36:05 -0400
Using XSLT 2.0 and Saxon HE 18.104.22.168
I've got an XML document generated from Excel and am writing a script to extract it into something more semantic.
I've got a way of establishing a reference point in the document, and am drawing data from behind it and in front of in order to convert a simple table into a semantic format. However, I'm seeing some strange behavior with preceding-sibling::.
The current content node is ss:Cell, given that, can anyone point out why:
<xsl:element name="package_pin"> <xsl:value-of select="preceding-sibling::ss:Cell"/> </xsl:element>
<xsl:for-each select="preceding-sibling::ss:Cell"> <xsl:if test="number(count(preceding-sibling::ss:Cell)+1) = 6"> <xsl:element name="general_cell"> <xsl:value-of select="."/> </xsl:element> </xsl:if> </xsl:for-each>
succeeds in drawing the content from the 6th cell in the current row?
As far as I can see, both start from the same context and test for the same condition, but one is direct and fails the other one reroutes flights from New York to Buffalo through Tokyo and succeeds. I'm baffled.
-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal