xsl-list
[Top] [All Lists]

[xsl] preceding-sibling:: oddity

2012-06-13 16:26:55
Hi all,

Using XSLT 2.0 and Saxon HE 9.3.0.5

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[11], given that, can anyone point out why:

  <xsl:element name="package_pin"> 
    <xsl:value-of select="preceding-sibling::ss:Cell[6]"/>
  </xsl:element>       

fails, yet:

  <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.

Thanks,
Jeff.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


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