hi guys - i'm really down because i cannot find / understand my xsl error and i have to finish my work very very soon
the error message (by using xalan to create from the xml file my html output) is the following:
xslt error: the expression does not evaluate to a node-set
and the code fragement is:
<xsl:template name="getNext">
<xsl

aram name="currentKnoten" />
<xsl:for-each select="$currentKnoten"> //error is in this line
</xsl:for-each>
</xsl:template>
ok here is the xml code (simplified of course)
<DATA name="testdata">
<OTHERDATA></OTHERDATA>
<INSTANCE class="Start" name="Example Data">
<ATTRIBUTE name="stuff"></ATTRIBUTE>
</INSTANCE>
<INSTANCE class="OpenData" name="OpenData-44422">
<ATTRIBUTE name="Data">Last Name</ATTRIBUTE>
<ATTRIBUTE name="Comment"/>
</INSTANCE>
<INSTANCE class="OpenData" name="OpenData-44425">
<ATTRIBUTE name="Data">Adress</ATTRIBUTE>
<ATTRIBUTE name="Comment"/>
</INSTANCE>
INSTANCE class="ClosedData" name="ClosedData-44431">
<ATTRIBUTE name="Data">Gender</ATTRIBUTE>
<RECORD name="Choice of Responses">
<ROW>
<ATTRIBUTE name="Response" type="STRING">male</ATTRIBUTE>
</ROW>
<ROW>
<ATTRIBUTE name="Response" type="STRING">female</ATTRIBUTE>
</ROW>
</RECORD>
</INSTANCE>
<INSTANCE class="OpenData" name="OpenData-44459">
<ATTRIBUTE name="Data">First Name</ATTRIBUTE>
<ATTRIBUTE name="Comment"/>
</INSTANCE>
<CONNECTOR class="Sub">
<FROM instance="Example Data" class="Start"/>
<TO instance="OpenData-44459" class="OpenData"/>
</CONNECTOR>
<CONNECTOR class="Sub">
<FROM instance="OpenData-44459" class="OpenData"/>
<TO instance="Open Data-44422" class="OpenData"/>
</CONNECTOR>
... some more connectors .....
</DATA>
so what is the aim..... as u can see there is wrong ordner in the xml
last name
address
gender
first name
but the output should be:
first name
last name
adress
gender
there is one way to get the right order --> you can look on the subsequent part there is a FROM and TO and there u can see how the output should look like.... start is of course start...
now i go back to the origin problem... my main idea is the following xsl code... may u can see here the problem with the node site.. but i think u need the xml file or?
however this is my relevant xsl code:
<xsl:template match="DATA">
<xsl:element name="process">
<xsl:attribute name="name">
<xsl:value-of select="@name" />
</xsl:attribute>
<xsl:apply-templates select="INSTANCE"/>
</xsl:element>
</xsl:template>
<xsl:template match="INSTANCE[@class='Data']">
<xsl:element name="node">
<xsl:attribute name="name">
<xsl:value-of select="@name" />
</xsl:attribute>
<xsl:attribute name="class">
<xsl:value-of select="@class" />
</xsl:attribute>
<xsl:call-template name="copyAttributes" />
<xsl:variable name="nextNodes">
<xsl:value-of select="key('keyGetData', key('keyFrom', @name)/../TO/@instance)" />
</xsl:variable>
<xsl:call-template name="getNext">
<xsl:with-param name="currentNode" select="$nextNodes" />
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template name="getNext">
<xsl

aram name="currentNode"/>
<xsl:for-each select="$currentNode">
<xsl:element name="node">
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
<xsl:variable name="nextNodes">
<xsl:value-of select="key('keyGetData', key('keyFrom', @name)/../TO/@instance)"/>
</xsl:variable>
<xsl:call-template name="copyAttributes"/>
<xsl:call-template name="getNext">
<xsl:with-param name="currentNode" select="$nextNodes"/>
</xsl:call-template>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template name="copyAttributes">
<xsl:for-each select="descendant::*">
<xsl:copy>
<xsl:copy-of select="@*|node()"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:apply-templates/>
</xsl:template>
hopefully u understand what i mean....