|
Subject: Re: [xsl] Reshuffling elements From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 26 Oct 2004 15:19:00 +0100 |
Hi Morten,
> I can extend this to heart's content, by adding more blocks, and
> increasing the DATA[1] to DATA[2], DATA[3] and so on, but I would
> rather have solution for any number of auxiliary links.
If I understand correctly, I think you need:
<xsl:variable name="categories" select="fmp:COL[5]/fmp:DATA" />
<xsl:variable name="names" select="fmp:COL[6]/fmp:DATA" />
<xsl:variable name="urls" select="fmp:COL[7]/fmp:DATA" />
<xsl:for-each select="$categories">
<xsl:variable name="pos" select="position()" />
<p>
<em><xsl:value-of select="." />: </em>
<xsl:value-of select="$names[$pos]" />
<xsl:text>, URL: </xsl:text>
<xsl:value-of select="$urls[$pos]" />
</p>
</xsl:for-each>
> When I try the following;
>
> <xsl:for-each select="fmp:COL[6]/fmp:DATA">
> <xsl:param name="n_pos" select="position()" />
>
> <p>
> <xsl:value-of select="$n_pos" />.
> <xsl:value-of select="." />,
> <xsl:value-of select="../following-sibling/child[1]" />
> </p>
> </xsl:for-each>
Note that <xsl:param> isn't legal within <xsl:for-each> (your
processor should give you an error). The path
"../following-sibling/child[1]" says "give me the first <child>
element child of each <following-sibling> element child of my parent".
I think you were aiming for something like:
../following-sibling::*/child::*[1]
which means "give me the first child of each following sibling of my
parent" (although that wouldn't give you what you were after either --
see above for a solution).
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Reshuffling elements, Morten Ryg | Thread | Re: Re: [xsl] Calling a different s, Olaf Wentzien |
| Re: Re: [xsl] Calling a different s, Olaf Wentzien | Date | Re: [xsl] xsl history, Wendell Piez |
| Month |