xsl-list
[Top] [All Lists]

RE: Literals in XSLT

2004-02-08 09:05:31
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(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Ruth Ablett
Sent: 08 February 2004 07:53
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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(_at_)hotmail(_dot_)com
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



<Prev in Thread] Current Thread [Next in Thread>