Subject: RE: [xsl] Problem passing Parameters From: "Mho Salim" <mho@xxxxxxxxxxxx> Date: Tue, 30 Aug 2005 08:54:32 -0600 |
I am not sure about ASP.NET but below is the way I transform XSL. I am using javax.xml.transform package. I hope this helps Mho Salim Corybant The XML stream looks like <?xml-stylesheet href="myfile.xsl" type="text/xsl"?> <myform> <var1_name><![CDATA[var1_value]]></var1_name> <var2_name><![CDATA[var2_value]]></var2_name> <var3_name><![CDATA[var3_value]]></var3_name> </myform> The XSL stylesheet (myfile.xsl) looks like <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="no"/> <xsl:template match="/myform"> <xsl:param name="var1_name"> <xsl:value-of select="var1_name"/> </xsl:param> <xsl:param name="var2_name"> <xsl:value-of select="var2_name"/> </xsl:param> <html> <head> </head> <body > <table > <tr valign="middle"> <td> <img src="{$var1_name}"/> </td> <td > <font color="{$var2_name}"> <xsl:value-of select="var3_name"/> </font> <td> </tr> </table> </body> </html> </xsl:template> </xsl:stylesheet> -----Original Message----- From: Ian E. Powell [mailto:Ian.Powell@xxxxxxxxxxxxx] Sent: Monday, August 29, 2005 5:15 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Problem passing Parameters I am passing in arguments to a XSLT file through an ArgumentList(ASP.NET). The values that I am passing into the XSLT transform call are not overiding the default values. Do I have to do something special for Strings? Do I need to provide a namespace? XML - File(ignore newline & hard return) "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>\r\n<Facility>\r\n <Activity>\r\n <MDBService>Price Analysis</MDBService>\r\n <Description>Dictation, Dictaphone Corporation</Description>\r\n <SendDate>1/24/2005</SendDate>\r\n </Activity>\r\n <Activity>\r\n <MDBService>Capital Maintenance Analysis</MDBService>\r\n <Description>Dictation, Dictaphone Corporation</Description>\r\n <SendDate>1/27/2005</SendDate>\r\n </Activity>\r\n</Facility>" XSLT - File <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!--Passing Parameters through XsltArgumentList--> <xsl:param name="reportDate" select="'ReportDate'"/> <xsl:param name="dateRange" select="'DateRange'"/> <xsl:param name="facName" select="'Facility Name'"/> <xsl:output version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="no" media-type="text/html" /> Bit that deals with Parameters <tr> <td> <xsl:value-of select="$facName"/> </td> <td> <xsl:value-of select="$reportDate"/> </td> </tr> <tr> <td> <xsl:value-of select="$dateRange"/> </td> </tr> _________________________________________________________________ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. _________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problem passing Parameter, andrew welch | Thread | [xsl] Merging nodes to process with, Russell Levy |
Re: [xsl] concat all items in a seq, andrew welch | Date | RE: RE: [xsl] Using a variable as p, cknell |
Month |