Hi there, I am new to the forum, but have been reading some posts and it look like a greta XML resource. I have a question that I cannot seem to answer. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl utput method="html" media-type="text/html"/> <xsl aram name="total"/>
<xsl:template match="TITLE"> <xsl:for-each select="."> <tr><td><xsl:number/></td><td><xsl:value-of select="count ($total)"/></td></tr> </xsl:for-each> </xsl:template> </xsl:stylesheet> Using Saxon processor at the command prompt I am passing a an absolute path with a param value by typing Saxon artists.xml artists.xsl total=/catalog/cd and getting an error telling me that value of my parameter ($select) is not a node-set. If I add a default value to the param in the stylesheet, there is no problem, but when I try to pass one in externally , the error occurs. What is my problem? Thanks in advance....Scott
count() accept a node-set as a parameter, and when you pass something into stylesheet, it is passed as a string. There is no conversion from string to node-set so <xsl:someElement select="$variable"... gives an error. Idiomatic workaround is: <xsl:someElement select="*[name(.) = $variable]" ... But I am not sure it will work when the path is included. Another variant, recommended by Michael Kay, Saxon�s author, is to use evaluate() extension function which takes a string with an XPath expression and evaluates it.