This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Question about Context Changes in XSLT Questions and Answers for David Carlisle


When I tested the XPath:A/C[postion()=2] and A/*[position()=2 and self::C],
they gave me the same results. So are they the same or not? Thanks

XML:
<?xml version="1.0" standalone="yes"?>
<a>
<c>c1<d>d11</d><d>d12</d>
<d>d13</d><d>d14</d></c>
<c>c2<d>d21</d><d>d22</d>
<d>d23</d><d>d24</d></c>
<c>c3</c>
<c>c4</c>
</a>

XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="a/*[position()=2 and self::c]">
	<td>(<xsl:value-of select="."/>)</td>
</xsl:template>

</xsl:stylesheet>


Mingdong (Don) Yao

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]