Subject: Re: [xsl] name of a template From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 18 Jan 2001 19:44:45 +0000 |
Hi Carmelo, > Is it possible to simulate the equivalent of an enumerated list in XSLT > (or any other list), then traverse the list and find the attributes that > way?, > Am I climbing the wrong tree by looking at that approach? Ahh, no, you're onto something there :) If you have your attribute sets defined as normal: <xsl:attribute-set name="property1"> <xsl:attribute name="foo">...</xsl:attribute> ... </xsl:attribute-set> <xsl:attribute-set name="property2"> ... </xsl:attribute-set> Then you can access them through the document() function. To get at the 'property1' attribute set, for example, you can use: document('')/*/xsl:attribute-set[@name = 'property1'] Now because you've got the name as a string, then if you have stored the position of the current node in a variable: <xsl:variable name="position" select="position()" /> then you can access the relevant attribute set using: document('')/*/xsl:attribute-set [@name = concat('property', $position)] You can then iterate over the attributes in this attribute set, adding the attributes: <xsl:for-each select="document('')/*/xsl:attribute-set [@name = concat('property', $position)]/xsl:attribute"> <xsl:attribute name="@name"> <xsl:value-of select="."> </xsl:attribute> </xsl:for-each> The big problem with this solution is that it won't work if the attribute in the attribute set is defined with anything but a simple value: if you have an xsl:choose or whatever to decide what the value is, then the above won't work. Nice idea :) Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] name of a template, Carmelo Montanez | Thread | RE: [xsl] name of a template, Michael Kay |
[xsl] RE: Determining the level of , David M. Goudreau | Date | Re: [xsl] the nearest ancestor with, G. Ken Holman |
Month |