Subject: [xsl] XML Elements to XML Attributes From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx> Date: Sat, 13 Jan 2007 20:31:30 -0500 |
I have a very simple question. I have currently the following xsl script (1). But instead of creating elements I would like to create attributes, something like:
Where $1-4 are the values coming from the loop at position() respectively 1-4. Coming from a C/C++ world I would have created variables, unfortunately I cannot do that with the loop. I must be missing something trivial to be able to rewrite it correctly in XSL.
(1) <entry> <xsl:for-each select="td"> <xsl:variable name="cur_val"> <xsl:value-of select="."/> </xsl:variable> <xsl:choose> <xsl:when test="position() = 1"> <tag d="{$cur_val}"/> </xsl:when> <xsl:when test="position() = 2"> <attribute d="{$cur_val}"/> </xsl:when> <xsl:when test="position() = 3"> <type d="{$cur_val}"/> </xsl:when> <xsl:when test="position() = 4"> <description d="{$cur_val}"/> </xsl:when> <xsl:otherwise> <bug/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </entry>
-- Mathieu
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using Jeni Tennisons Mark, bryan rasmussen | Thread | Re: [xsl] XML Elements to XML Attri, Andrew Franz |
Re: [xsl] rendering xml fragment tr, Florent Georges | Date | Re: [xsl] XML Elements to XML Attri, Andrew Franz |
Month |