Subject: Re: [xsl] name of the current mode From: David Carlisle <davidc@xxxxxxxxx> Date: Sat, 14 Nov 2009 23:45:48 GMT |
an fxsl-inspired (I think) answer: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="x"> <x> <a> <b/> <c/> </a> <d/> </x> </xsl:variable> <xsl:template match="q:___" xmlns:q="data:,q" mode="one">one</xsl:template> <xsl:template match="q:___" xmlns:q="data:,q" mode="two">two</xsl:template> <xsl:template match="q:___" xmlns:q="data:,q" mode="three">three</xsl:template> <xsl:variable name="modetest" as="element()"> <q:___ xmlns:q="data:,q"/> </xsl:variable> <xsl:template name="m"> <xsl:message select="'-------------'"/> <xsl:apply-templates mode="one" select="$x/*"/> <xsl:message select="'-------------'"/> <xsl:apply-templates mode="two" select="$x/*"/> <xsl:message select="'-------------'"/> <xsl:apply-templates mode="three" select="$x/*"/> <xsl:message select="'-------------'"/> </xsl:template> <xsl:template match="*" mode="#all"> <xsl:variable name="mode"> <xsl:apply-templates select="$modetest" mode="#current"/> </xsl:variable> <xsl:message select="name(), 'in mode ', $mode"/> <xsl:apply-templates mode="#current"/> </xsl:template> </xsl:stylesheet> $ saxon9 -it m mode.xsl ------------- x in mode one a in mode one b in mode one c in mode one d in mode one ------------- x in mode two a in mode two b in mode two c in mode two d in mode two ------------- x in mode three a in mode three b in mode three c in mode three d in mode three ------------- ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] name of the current mode, G. Ken Holman | Thread | Re: [xsl] name of the current mode, David Carlisle |
Re: [xsl] fo:basic-link, J.Pietschmann | Date | Re: [xsl] name of the current mode, David Carlisle |
Month |