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

Re: Variable names *as* variables

Subject: Re: Variable names *as* variables
From: "Nikolai Grigoriev" <grig@xxxxxxxxxxx>
Date: Sat, 14 Oct 2000 01:09:33 +0400
xsl solution for immutable variables
John ,

> John E. Simpson wrote:
> Just out of curiosity, in what sense do you consider your proposed solution
> to be "interspersing style with data"? Granted it's something of a hack --
> providing data in the stylesheet that's not in the source document -- but
> only in the sense that *any* literal result element does so, no?

There are no fixed criteria: it's all based upon aesthetic considerations ;-).
Maybe I have misinterpreted your data, but it seemed to me that your location
names  were also subject to change: you kinda reserved a possibility to add more
locations in the future. In my perception, a stylesheet should include "eternal"
things - it is supposed to be independent of the data. But maybe I am wrong, and
your city names are universal constants in your application domain, with their
numbers known to everybody and immutable - then it is OK ;-).

By the way: if you insist on including these data into a stylesheet, the most
straightforward way of doing it is to wrap them in templates that fire on
attributes, rather than variables. I mean the following:

<xsl:template match="@place[.='location1']">Midtown</xsl:template>
<xsl:template match="@place[.='location2']">Greater Northeast</xsl:template>
<xsl:template match="@place[.='location3']">Dallas-Ft. Worth</xsl:template>

Then, to insert a location into the output, you can just write:

<xsl:apply-templates select="@place"/>

IMHO, this is not much longer than using variables;  and document('') trick is
avoided.

Best regards,

Nikolai Grigoriev
RenderX









>
> Thanks very much, Nikolai. (And thanks also to Ken Meltsner, whose solution
> was even sneakier!)
>
> ===============================================================
> John E. Simpson               | "He asked me if I knew what
> http://www.flixml.org         | time it was. I said, 'Yes, but
> XML Q&A: http://www.xml.com   | not right now.'" (Steven Wright)
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.