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

Re: dynamic variable name/implementation question

Subject: Re: dynamic variable name/implementation question
From: "Nathan Young" <natyoung@xxxxxxxxx>
Date: Thu, 25 Aug 2005 13:26:47 -0700
perl dynamic variable name
Hi.

I agree that the nodeset solution offered below is the most flexible solution (you can pass one in or load one with the document() function). Parsers differ in the way they handle this; using LibXML with perl I use the document function but haven't figured out how to pass a DOM as a param.

However, the way you describe passing things in using parameters constrains you to a fixed set of params defined in your stylesheet so you could go with a choose block in your template match.

--->N

On Thu, 25 Aug 2005 11:36:03 -0700, Michael Kay <mike@xxxxxxxxxxxx> wrote:

The usual solution is that instead of passing your stylesheet three
parameters x, y, and z, you should pass it an XML document

<param>
  <x>1</x>
  <y>2</y>
  <z>3</z>
</param>

and then you can navigate this document at will using XPath.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Ed S [mailto:lists@xxxxxxxxxxxxxxxxxxxxx]
Sent: 25 August 2005 19:17
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  dynamic variable name/implementation question

Hi-
I'm trying to find a workaround or alternate implementation for a
particular problem I'm tring to solve.  I have various parameters that
are passed into the processor, and I would like to use their values in
the stylesheet.  However, I've found that XSLT 1.0 does not support
dynamic variables.
I would like to do the following:

XML:
...
<text-block>
   this is some text. Folowing is dynamic- <external-value
parameter="someParam"/> -preceding was dynamic
</text-block>
...

XSL:
...
<xsl:template match="external-vaue">
    <xsl:value-of select="$@parameter"/> <!-- this won't work -->
</xsl:template>
...

where there is a parameter "someParam" passed into the
stylesheet - say
someParam="foo".  My output would be:
...
 this is some text. Folowing is dynamic- foo -preceding was dynamic
...

Has anybody else ever needed this fuctionality?



--



.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:.


Nathan Young
A: ncy1717
E: natyoung@xxxxxxxxx

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.