[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Comparing node for identity using union

Subject: Re: [xsl] Comparing node for identity using union
From: António Mota <amsmota@xxxxxxxxx>
Date: Fri, 14 Jan 2005 19:46:42 +0000

Thanks for that. I think i'm at that dangerous time when one thinks
allready knows their stuff, just to discover that that's a never
ending story...

I have everithing working again Ok, i didn't reach a conclusion on why
it stop working. I'm using now

<xsl:variable name="snode" select="(//Menu)[$pos]"/>
<xsl:when test="count($snode)=1 and count(parent::Menu|$snode)=1">

meaning "when my parent Menu is the Menu at position pos".

I had a wreck of a time because each processor gives me a diferent
thing in the debugger. Ex. Saxon gives a node-set(0) when watching
(//Menu)[0] but Xalan gives error, altought the output is functionaly
equal. And there were another diferencs too...

The problem wasn't exclusive on this, it was probably a chain of small
errors, but this was one of then.

However, and OT, this i has another STRANGE problem. I'm invoking the
XSLT from Javascript (sarissa) and when using the Firefox
XSLTProcessor i get a strange behaviour...

This is what i post in the Sarissa forum, altought this seems a bug on
the XSLTProcessor. I wonder if i should post this in here with a
expressive subject for the archives, in case someone get's the same

I tracked down the problem, and i just can4t believe this!!! In my
sheet i have

<xsl:variable name="snode" select="(//Menu)[$pos]"/>

for a XML like this:

<Menu> ->1
<Menu/> ->2
<Menu/> ->3

that must select the node 1,2,3 corresponding to the pos 1,2,3.

Now i just put a verification on XSLT

<xsl:message>count: <xsl:value-of select="count($snode)"/></xsl:message>

that i expected to ALLWAYS return 1, cause select="(//Menu)[$pos]"
select only one node.


xml.transformNodeToObject(xslDoc, xmlResult); it

works as i expected. However with

var xmlResult = processor.transformToDocument(xmlDoc);

the result of the message is THE TOTAL COUNT of //Menu, in this example 3.

This is clearly a bug on XSLTProcessor, don't you think? What can i do
with this?

Current Thread