Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL:Count on a passed parameter

From: KevinBurton@-----------.---------.---
To: NULL
Date: 7/30/2008 9:28:00 AM

I am using the XSLT processor that .NET uses. I am assuming that it is with 
the latest version of MSXML. When I form the XML string and pass it as an 
argument it seems that the XSLT processor (at least with .NET) 
"automatically" turns it into an XmlDocument. I have been using this for some 
time now, using the expression as part of an XPath expression in the XSLT 
stylesheet:

<xsl:if test="current()/Relationship/Relation/SKU = 
$IdenticalList/root/list/sku">

looping through the values, etc. I hae just run into this problem with the 
function count().

I think what you are describing below is the behavior that I have come to 
rely on. Now I just want to return the count of an XPath expression on that 
node list. Any ideas on how to do that?

Thank you.

Kevin



"Martin Honnen" wrote:

> Kevin Burton wrote:
> > I am building an XML string and passing it as a parameter to the XSL style 
> > sheet. Currently I have something like:
> > 
> > Identical Errors - <xsl:value-of 
> > select="count($IdenticalList/root/list/sku)"/>
> > 
> > Where $IdenticalList is the XML string that is passed in. 
> 
> Which XSLT processor are you using?
> If you have a string with XML markup and you want that to be parsed as 
> XML then you can't simply pass it to the XSLT processor, rather you 
> first need to parse it yourself and then, if the XSLT processor supports 
> it, you can pass in a node to the XSLT processor. For instance, for 
> MSXML and the addParameter method, the documentation
> http://msdn.microsoft.com/en-us/library/ms762312(VS.85).aspx
> shows that you can pass in an XML DOM node or a node list.
> With .NET and XslCompiledTransform and XsltArgumentList, see
> http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addparam.aspx
> you can pass in an XPathNavigator so you would first parse your XML 
> string with XPathDocument, then create an XPathNavigator and pass that in.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent