On 25/06/2011 16:31, dba03 wrote:
The xsl file is from a c# open source project. What  I do is to translate the c# application into java application.
The original namespace of node-set is "xmlns:msxsl="urn:schemas-microsoft-com:xslt">", so I change it to xmlns:msxsl="http://exslt.org/common".

I'm not 100% sure that the two functions are 100% equivalent. It looks as if msxsl:node-set does something useful if given a string as input. I can't see any specification that describes what it does in this case (see for example http://msdn.microsoft.com/en-us/library/dd950745(v=office.12).aspx, which only talks of supplying a result-tree-fragment as input). Without knowing what the existing code does, it's hard to advise on how to convert it. It's possible that msxsl:node-set() when given a string is treating the string as source (lexical) XML and parsing it, in which case you would need to replace it with a call to saxon:parse(). However, I can't find anything that suggests this interpretation is correct.

Regards,

Michael Kay
Saxonica

There are several places calling template "CreateShape". Some provide the parameter "varHyperLinksForShapes" which is result-tree-fragment, but some of them doesn't provide it, so the parameter "varHyperLinksForShapes" is (maybe) null under this condition and the error appear. I temporarily resolved it by adding a meaningless result-tree-fragment parameter. 

Thanks.

At 2011-06-24 17:11:39úČ"Michael Kay" <mike@saxonica.com> wrote:

Using the "msxsl" prefix here had me confused for two seconds - let's use the more conventional "exslt" to avoid such misunderstanding.

The EXSLT specification of the node-set() function is here:

http://www.exslt.org/exsl/functions/node-set/index.html

The main purpose of the function is to turn an XSLT 1.0 result-tree-fragment into a singleton node-set. That's a no-op in XSLT 2.0, so Saxon's implementation of exslt:node-set() is a no-op - it returns its argument unchanged.

Now, looking at the spec, that doesn't seem to be the right thing to do when you give it a string. The spec is very vague about what the function should do when given a string, but it does seem to be clear that the expected result is a node-set. Perhaps the idea is simply to turn the string into a text node. That doesn't seem to be your expectation, since you're expecting it to return a node that has descendants. I've also come across the expectation that the string should be treated as a path expression and evaluated, but there doesn't seem to be any hint of that in the spec. So what were you expecting the function to do?

Michael Kay
Saxonica


On 24/06/2011 09:19, dba03 wrote:
1. The error is:
net.sf.saxon.trans.XPathException: Required item type of first operand of '/' is node(); supplied value has item type xs:string
 
2. The xsl file:
<xsl:stylesheet version="2.0" 
>
......
  <xsl:template name ="CreateShape">
  <xsl:param name="varHyperLinksForShapes" select="''"/>
......
  <xsl:if test="msxsl:node-set($varHyperLinksForShapes)//presentation:event-listener">
  <xsl:copy-of select="$varHyperLinksForShapes"/>
  </xsl:if>
......
 
3.
Error occur at "msxsl:node-set($varHyperLinksForShapes)".
 
Thanks!
 
 
 
2011-06-24

dba03
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help