|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Question about variable definition and types
Andrew and David,
Thanks a lot -- even on Friday afternoon one can learn some interesting XSL! Am 07.03.2008 um 11:43 schrieb David Carlisle: If you go <xsl:variable name="a2" as="element()*"> <xsl:sequence select="a"/> </xsl:variable> in $a2 they are the original a nodes in the source document (so necessarily siblings as they are selected by the xpath "a" so all children of the current node at that point. In this case $a2 holds these nodes, and they are (still) siblings, but they may have other siblings not contained in the variable, and their parent node is similarly not cotained in the variable.
If I have <root> <a/> <b/> <a/> <a/> <c/> </root> <xsl:template match="root">
<xsl:variable name="a2" as="element()*">
<xsl:sequence select="a"/>
</xsl:variable>
<xsl:copy>
<xsl:for-each select="$a2">
<xsl:copy>
<xsl:attribute name="pos" select="position()"/>
<xsl:attribute name="pre" select="name(preceding-sibling::*
[1])"/>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>I get <root> <a pos="1" pre=""/> <a pos="2" pre="b"/> <a pos="3" pre="a"/> </root> How would I access the preceding/following siblings from "inside" the variable with the as attribute? - Michael -- _______________________________________________________________ Michael M|ller-Hillebrand: Dokumentations-Technologie Adobe Certified Expert, FrameMaker Lvsungen und Training, FrameScript, XML/XSL, Unicode <http://cap-studio.de/> -- Tel. +49 (9131) 28747
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






