[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Attribute Value Template
As an update for posterity, it works.
So, to recap, i have XML that looks like: <body>Subscriber agrees to pay Company the sum of $<sub name="install"/>, plus tax, if applicable, for the installation (and sale if the System is sold) of the System as follows: $<sub name="down_pmt"/> upon signing this Agreement; $<sub name="pre_wire_pmt"/> upon pre-wiring, if necessary; $<sub name="final_pmt"/> upon substantial completion of installation.</body> And I proces that with XSLT as such: <xsl:template match="body"> <fragment font="Helvetica" fontsize="7"> <xsl:apply-templates /> </fragment> </xsl:template> <xsl:template match="sub"> <xsl:variable name="name" select="./@name"/> <xsl:value-of select="$subvalues/*[@name = $name]"/> </xsl:template> And finally, I pass a nodeset from C# as follows: XmlDocument paramDoc = new XmlDocument(); paramDoc.LoadXml("<subvalues><subvalue name='install_pmt'>1,000,000</subvalue><subvalue name='pre_wire_pmt'>20,000</subvalue></subvalues>"); XPathNavigator navigator = paramDoc.DocumentElement.CreateNavigator(); XsltArgumentList argList = new XsltArgumentList(); argList.AddParam("subvalues", "", navigator.Select("/*")); And it works like a charm. The key is passing an XPathNodeIterator to the xsl:param (the Select() method returns the XPathNodeIterator). If anyone wants further details, let me know, and I'll put together a sample app. :) P.S. Thanks everyone. Michael Kay wrote: Passing parameters depends on the platform you are using. The mention of C# gives the clue that you're on the Microsoft platform. You can create a DOM and pass the document object as a parameter to the stylesheet, accessing the contents of the DOM using path expressions. -- David B. Bitton david@xxxxxxxxxxxxxx www.codenoevil.com Code Made Fresh Daily™ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|