Subject: RE: Literals in XSLT
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 8 Feb 2004 16:05:31 -0000
|
If you want to construct XPath expressions on the fly as strings, you
will need the xx:evaluate() extension which several products (Saxon,
Xalan, ...) offer.
Michael Kay
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Ruth Ablett
> Sent: 08 February 2004 07:53
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Literals in XSLT
>
>
> Hello,
>
> I am attempting to write an XML-to-XML filter for document
> entries. The user
> can filter the XML file by author, title, or type (ps, pdf,
> doc, etc).
> Structure of xml:
>
> <?xml version="1.0">
> <repository>
> <so>
> <author>Bob</author>
> <title>I Like Cheese</title>
> <type>pdf</type>
> </so>
> </repository>
>
> To do it all in one XSL file, I wrote the following:
>
> <xsl:param name="query">'Ruth Ablett'</xsl:param>
> <xsl:param name="search-mode">=</xsl:param>
> <xsl:param name="sort-by">author</xsl:param>
> <xsl:param name="BigQuery" select="concat($sort-by,
> $search-mode, $query)"/>
>
> ... XSL required stuff...
>
> <xsl:template="/">
> <xsl:if test="{$BigQuery}">
> <xsl:apply-templates select="so">
>
> ... the "so" template has the required stuff to filter the document.
> However, the transformer blows up at {$BigQuery}. Can I use
> literals {} like
> that?
>
> Thanks.
> Ruth
>
> --------
> Ruth Ablett
> utaku_rutsuko@xxxxxxxxxxx
> http://www.geocities.com/tokyo/4390
>
> "Microsoft's No. 1 product is Windows, which now comes automatically
> installed on every computer in the world and many kitchen appliances.
> Technically, Windows is an "operating system," which means
> that it supplies
> your computer with the basic commands that it needs to
> suddenly, with no
> warning whatsoever, stop operating.
>
> I speak from experience here. Many a time I have spent hours
> writing a
> serious and thoughtful column on an important issue, only to
> have Windows --
> which is often referred to as "the French labor union of
> software" -- get
> into a snit and call a general computer strike that erases
> all my work
> moments before deadline, leaving me with no choice but to
> bang out a highly
> inaccurate column such as this one."
>
> - Dave Barry
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=dept/features&pgmarket=en-ca&RU=http
> %3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmar
> ket%3den-ca
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|