|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: What did "template match" match?
> > > When my template matches a number of possible patterns:
> > >
> > > <xsl:template match=3D'X|Y'> ... </xsl:template>
> > >
> > > Is there a way of determining the value of what was actually
> > > matched?
> >
> > No.
> >
> > If you want different behavior for the two cases, split it up
> > into two templates.
>
> No! As Benjamin Boksa said, "name()" can do it:
>
> <xsl:template match="todo|author|changes">
> <xsl:value-of select='name()'/>
> <xsl:element name='{name()}'>
> <xsl:apply-templates/>
> </xsl:element>
> </xsl:template>
>
That's assuming the different patterns match different names. Doesn't work
for, say
match="chapter/title | section/title"
Michael Kay
http://www.saxonica.com/
|
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








