Hello group,
I'm having a problem (possible bug) with msxml4 parser and the node-set
ext. function. I'm generating a small RTF to reduce the number of loops
and thereby the process time.
I tried to cut-out a small part from my styleseheet. The node-set
function itself is working, but after that some things stop working.
Below you find my source XML, I cut out most not needed parts, it then
generate a nodeset with the xml below:
<!----------------------------------->
<xsl:variable name="learningobjects">
<xsl:element name="learningobjects">
<xsl:for-each
select="/root/data/COURSE/RESULT[not(@IDLEARNINGOBJECT =
preceding::node()/@IDLEARNINGOBJECT)]">
<xsl:element name="lo"><xsl:attribute
name="id"><xsl:value-of select="@IDLEARNINGOBJECT"/></xsl:attribute>
<xsl:attribute
name="cname"><xsl:value-of select="@CLEARNINGOBJECT"/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:variable>
It generates this:
<!----------------------------------->
<learningobjects>
<lo id="46" cname="Deze training" />
<lo id="47" cname="Gedachtevorming" />
<lo id="48" cname="Theorie" />
<lo id="50" cname="Transferdag" />
</learningobjects>
I've then replaced this part below which was working well:
<!----------------------------------->
<xsl:for-each select="/root/data/COURSE/RESULT[not(@IDLEARNINGOBJECT =
preceding::node()/@IDLEARNINGOBJECT)]">
<xsl:variable name="lo" select="@IDLEARNINGOBJECT"/-->
-<xsl:value-of select="$lo"/>-<xsl:value-of
select="/root/data/COURSE/RESULT[(_at_)IDLEARNINGOBJECT=
$lo]/@CLEARNINGOBJECT"/>
</xsl:for-each>
<!--
The part above show me numbers and names
The new code looks like this below, usign the node-set ext. fucntion.-->
<xsl:for-each
select="msxsl:node-set($learningobjects)/learningobjects/lo"><xsl:variab
le name="lo" select="@id"/>
-<xsl:value-of
select="$lo"/>-<xsl:value-of
select="/root/data/COURSE/RESULT[(_at_)IDLEARNINGOBJECT=
$lo]/@CLEARNINGOBJECT"/>
<!--<xsl:value-of select="@cname"/>--> 
</xsl:for-each>
<!--
It doesn't show me the names anymore.. The statement:<xsl:value-of
select="$lo"/> is still showing the same Id list, but
<xsl:value-of select="/root/data/COURSE/RESULT[(_at_)IDLEARNINGOBJECT=
$lo]/@CLEARNINGOBJECT"/>
Doesn't show me the names anymore. It looks like the part in between []
arent doeibng anything anymore. I can put [(_at_)IDLEARNINGOBJECT= 46] in it,
but even then it doesn't give me a name ( value of @CLEARNINGOBJECT).
Is this a known bug in MSXML4?
Regards
Henk Meulekamp
<!-----big XML---------------------------------------->
<root><data><COURSE><RESULT IDUSER="562" CUSERNAME="d_31_test2"
CTYPENAME="amsterdam" IDCOMPANY="31" IDLOCATION="99" IDFUNCTION="41"
IDDEPARTMENT="43" NUMSTUDIED="0" NUMTOSTUDY="1" DONE="0"
IDLEARNINGOBJECT="50" CLEARNINGOBJECT="Transferdag"></RESULT><RESULT
IDLEARNINGOBJECT="46" CLEARNINGOBJECT="Deze training"></RESULT><RESULT
IDLEARNINGOBJECT="47" CLEARNINGOBJECT="Gedachtevorming"></RESULT><RESULT
IDLEARNINGOBJECT="48" CLEARNINGOBJECT="Theorie"></RESULT><RESULT
IDLEARNINGOBJECT="50" CLEARNINGOBJECT="Transferdag"></RESULT>
<!--..Many more..-->
</COURSE></data></root
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list