Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XsltArgumentList doesn't accept long parameter values

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 2/6/2006 3:16:00 PM
<hulkko123@y...> wrote in message 
news:1139238701.366832.150650@z......
>I have problems passing parameters from C# application to XSL file and
> doing a transformation.
> My code is below.:
>
> XsltArgumentList xslArg = new XsltArgumentList();
>
> String key = "grandpa/father/son";    // This is the name of node I
> want pass and gets it value
> xslArg.AddParam("xslParam", "", key);
>
> // Create the XslTransform and load the stylesheet.
> XslTransform xslt = new XslTransform();
> xslt.Load(stylesheet); // xsl stylesheet
>
> XmlUrlResolver xmlUrlResolver = new XmlUrlResolver();
>
> // Output to console.
> XmlTextWriter writer = new XmlTextWriter(Console.Out);
>
> // Transform the xml file
> xslt.Transform(new XPathDocument(filename), xslArg, writer,
> xmlUrlResolver);
>
> writer.Close();
>
> ----------------
>
> XSL file looks like this
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:param name="xslParam"/>
>  <xsl:template match="/">
>      <alku><xsl:value-of select="$xslParam"/></alku>
>  </xsl:template>
> </xsl:stylesheet>
>
>
> The problem is that node grandpa/father/son is not executed! It's
> passed to XSL file
> but XslTransform classes transsform method does not fetch it's value
> from xml file.
> It only shows the key value in console. Node grandpa/father/son has
> value in it's
> xml file.
>
> So, am I missing something or is there a bug in XsltArgumentList and
> it's transformation.
>
> Has anyone any ideas what could be wrong?
>
> Cheers!
>
You're just passing a string as a parameter, not a nodeset. XSLT can't 
dynamically execute a string i.e. treat it as a nodeset.
You can pass a nodeset by selecting the nodes from the document and passing 
them in and there maybe alternatives for getting what you but this way just 
won't do it.

-- 

Joe Fawcett (MVP - XML)

https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 




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