This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Passing Variables to XSL Templates


"but if your variable is a parameter in the URI"

What does this mean? What is the URI? What I want to do is pass a variable
from a template (say content.cfm?id=thispage)

Then in the XSL Template I want to access the value of id (from the URL or
other method) and use it to select a specific section of my XML document.

sample XML:
<content>
	<page>thispage</page>
	<textblob>
	 	This is the content I want to access.
	</textblob>
</content>

sample XSL:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:param name="pname" />
<xsl:template match="/">
<table>
	  <xsl:for-each select="site/content">
	  <tr>
	  	<td class="body" valign="top">
		  <xsl:if match=".[page='$pname']">
			  <xsl:value-of select="textblob"/>
		  </xsl:if>
	    </td>
	  </tr>
	  </xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

Is this even possible???

Joshua Miller
Web Development::Programming
Eagle Technologies Group, Inc.
www.eagletgi.com
josh.miller@eagletgi.com

-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Fridiric
SCHWEBEL
Sent: Wednesday, June 27, 2001 8:23 AM
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] Passing Variables to XSL Templates


I don't know if it helps, but if your variable is a parameter in the URI,
write :
<xsl:param name="name" />
at the beginning of the stylesheet (just after your <xsl:stylesheet> root
tage, and before any <xsl:template match="..."> )

then you'll have access to $name as the variable. Since "name" is a reserved
word, I don't know if you can use it as a variable name...

and the function you want to use is name(.) , not NAME.

Frederic

----- Original Message -----
From: "Joshua Miller" <josh.miller@eagletgi.com>
To: "Xsl-List@Lists.Mulberrytech.Com" <xsl-list@lists.mulberrytech.com>
Sent: Wednesday, June 27, 2001 1:47 PM
Subject: [xsl] Passing Variables to XSL Templates


> Greetings,
>
> Newbie question for the XSL masters - is there anyway that I can pass a
> variable into an XSL Template to populate a CASE statement?
>
> Want to do something like: <xsl:if match=".[NAME='$name']">
> But the variable will be coming from either ColdFusion, ASP, JAVA or
> somewhere else.
>
> Is this possible???
>
> Joshua Miller
> Web Development::Programming
> Eagle Technologies Group, Inc.
> www.eagletgi.com
> josh.miller@eagletgi.com
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]