|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Are variables allowed in XPATHs?
> I must say, I find this restriction somewhat > amazing. I assume it's intended to reduce the > complexity of writing XSL processors? Actually I stated the restriction wrongly. Some patterns in XSLT can contain variable references, but the ones used in the match attribute of xsl:template and xsl:key can't. The restriction was a misguided attempt to eliminate the possibility of circularities, in constructs like: <xsl:variable name="x"> <xsl:apply-templates/> </xsl:variable> <xsl:template match="*[$x]"> ... </xsl:template> To circumvent the restriction, you need to use an xsl:choose inside the template: <xsl:template match="*"> <xsl:choose> <xsl:when test="position()=$x"> ... The restriction has been lifted in XSLT 2.0. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








