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

Issue (local-constants)

Subject: Issue (local-constants)
From: "Lawton, Scott" <slawton@xxxxxxxxxxxx>
Date: Fri, 6 Nov 1998 14:42:08 -0500
local constants
	Issue (local-constants): Should there be a way to define local
constants?
Yes!

And/or: local or global variables.

For example, given this XML as input:
	<item>Fancy</item>
	<item selected="true" value="Dull">Plain</item>

In the first instance, I want to use the contents of the item as both the
visible text and, since there's no value attribute, also use it as the
value:
	Fancy: <newItem value="Fancy"/>

In the second, I want to use the contents as the visible text and the value
attribute as the value:
	Plain: <newItem value="Dull"/>

So, now to my XSL wish list:

<xsl:if test="attribute(value)">
	<xsl:define-constant name="myValue" value="{attribute(value)}"/>
<xsl:else>
	<xsl:define-constant name="myValue" value="{.}"/>
	</xsl:else>
</xsl:if>

Then I could do:
	<newItem value="{constant(myValue)}"/>
Scott
P.S. Did I mention I'd like an xsl:else?  :)


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


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.