Subject: [xsl] xsl transform From: "Philippe LAPLANCHE" <philippe.laplanche@xxxxxxxxxxxx> Date: Tue, 28 Jun 2005 15:58:19 +0200 |
Hello, Does somebody has a neet way to convert this tree : <?xml version="1.0" encoding="UTF-8"?> <results> <row> <param1>p1</param1> <param2>p2</param2> <param3>p3</param3> <param4>p4</param4> <param5>p5</param5> <param6>p6</param6> ... <paramn>pn</paramn> </row> <row> ... </row> </results> Into this one : <?xml version="1.0" encoding="UTF-8"?> <root fields="param1|param2|param3 ... "> <e a="p1" b="p2" c="p3" d="p4" e="p5" f="p6" ... z="p26" aa="p27" ab="p28" ... az="p52" ba="p53" .... zz="p702" /> </root> I'm thinking of using a list of attributes names but I can't find how-to First I don't know how to define a list, I want something like that: <xsl:variable name="attributes"> a,b,c,d,e,... </xsl:variable> In order to access attributes[n] and use it as an xsl:attribute's name I'd have templates that look like that : <xsl:template match="/results"> (this works fine) <root> <xsl:attribute name="fields"> <xsl:for-each select="row[1]/*"> <xsl:value-of select="local-name()"/> <xsl:if test="not(position()=last())">|</xsl:if> </xsl:for-each> </xsl:attribute> <xsl:apply-templates/> </root> </xsl:template> <xsl:template match="row"> (this I don't know how to make it work) <e> <xsl:for-each select="*"> <xsl:attribute name="????"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> </e> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] both single and double qu, Michael Kay | Thread | Re: [xsl] xsl transform, James Fuller |
Re: [xsl] Can't identify last ances, Sam D. Chuparkoff | Date | Re: [xsl] xsl transform, James Fuller |
Month |