Hi,
I'm trying to find the right XSLT to output dataSets
into groups associated with a radio button for each
set.
So, I want to loop over each "dataSet"
then loop over the sub-elements contained in there,
in my instance, <Image><Head><subhead>
How do I get to Image, Head and subhead ?
I've got the following on my XSL:
<xsl:variable name="dataSet"
select="dataSets/dataSet"/>
the dataSet element in the source example below is in namespace
"http://ns.adobe.com/GenericCustomNamespace/1.0/", thus you need to declare it
in you stylesheet, e.g. as prefix "d", and the above will be
<xsl:variable name="dataSet" select="dataSets/d:dataSet"/>
<xsl:for-each select="$dataSet">
<xsl:variable name="current" select="local-name()"/>
<tr><td>
<input type="radio" name="dataSet"
value="{(_at_)dataSetName}"/>
</td>
<td>
<xsl:value-of select="@dataSetName"/>
</td>
<td>
<xsl:variable name="innerElement"
select="$current/*"/>
The variable $current is bound to a string value, thus you can't use it a
locations step.
<xsl:for-each select="$innerElement">
<xsl:value-of select="."/><BR/>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
It this
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:d="http://ns.adobe.com/GenericCustomNamespace/1.0/">
<xsl:template match="/">
<html>
<head>
<title/>
</head>
<body>
<table>
<tbody>
<xsl:for-each select="dataSets/d:dataSet">
<tr>
<td>
<input type="radio" name="dataSet" value="{(_at_)dataSetName}"/>
</td>
<td>
<xsl:value-of select="@dataSetName"/>
</td>
<td>
<xsl:for-each select="*">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
What you were after?
Cheers,
Jarno - Wolfsheim: I Don't Love You Anymore
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list