Subject: RE: [xsl] can you select name() of attributes? From: "Michael Kay" <mhk@xxxxxxxxx> Date: Tue, 27 Jul 2004 11:08:24 +0100 |
> I want something that selects all the names of the > attributes. Is something > like the following possible? > <xsl:variable name="Attr" select="$Doc/@*/name()"/> or > <xsl:variable name="Attr" select="$Doc/name(@*)"/> > The XPath type system doesn't allow sequences of strings, so you can't assign a collection of names to a variable. (As DC pointed out, you can iterate over this collection, though). XPath 2.0 does allow sequences of strings. However the "/" operator only works on sequences of nodes (a much-debated question). So you would write: <xsl:variable name="attr" select="for $n in $Doc/@* return name($n)"/> This then allows if ($attr = 'abc') to test if any of the names is equal to 'abc'. Michael Kay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] can you select name() of , David Carlisle | Thread | Re: [xsl] can you select name() of , Ragulf Pickaxe |
Re: [xsl] XSL resources - Flat to h, David Carlisle | Date | RE: [xsl] XSL resources - Flat to h, Ben Simkins |
Month |