[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Issue (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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|