|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: variable matching...
<xsl:template match="$stage"> Your stage variable contains a result tree fragment (or in xslt2 a node set consisting of a single document node which has a text node child with value "stagedir") neither of these is an Xpath pattern, so neither can be used in a match attribute. In XSLT 2 however you could do <xsl:template match="*[name()=$stage]" as the annoying restriction of not allowing variables in match patterns is planned to be dropped. An alternative approach of course, is rather than try to paramaterise your tempates so they work for all inputs, do a two pass system that normalises the input. ie have a main stylesheet that does <xsl:template match="title">.... then to customise for your second form, in stead of doing this: <xsl:variable name="stage">stagedir</xsl:variable> do this <xsl:template mode="normalise" match="t"> <title> <xsl:apply-templates mode="normalise"/> </title> </xsl:template> This is more flexible as it can cope with differences in structure that are slightly greater than just element renaming. If on the other hand the structures are really identical you might not need names at all eg your two examples could be handles using patterns of match="body/*[1]" (t or title) match="body/*[position() > 1]" (A or Act) match="body/*/*" (scn or scene) etc -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ 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








