Subject: Re: Variable names *as* variables From: "Nikolai Grigoriev" <grig@xxxxxxxxxxx> Date: Sat, 14 Oct 2000 01:09:33 +0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Variable names *as* variables, John E. Simpson | Thread | Re: Variable names *as* variables, Paul Tchistopolskii |
The document() function....again !!, Melvyn Rosengarden | Date | RE: The document() function....agai, Ed Blachman |
Month |