[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem passing Parameters

Subject: RE: Problem passing Parameters
From: "Mho Salim" <mho@xxxxxxxxxxxx>
Date: Tue, 30 Aug 2005 08:54:32 -0600
asp.net pass parameters
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.