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

RE: How to Display as text the select predicates of a

Subject: RE: How to Display as text the select predicates of apply-templates
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 20 Jan 2005 09:07:49 -0000
select show text
Well, there aren't many programming languages that allow a program to read
its own source code, but you're in luck, because XSLT is one of them.

<xsl:value-of select="document('')/*/xsl:variable[@name='bool']/@select"/>

should do the trick.

The alternative solution to this problem is to have the search conditions
supplied as a string (for example in a stylesheet parameter or a
configuration file) and to use dyn:evaluate() to turn the string into an
expression that you can evaluate.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: david [mailto:dariggs@xxxxxxxxxxxxxx] 
> Sent: 20 January 2005 07:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How to Display as text the select predicates 
> of apply-templates
> 
> I am using xslt to search an xml file of resonses to a 
> survey. I want to 
> display the search predicates at the top of the results of 
> the search. 
> How do I get at the text of the search to show what the argument was 
> that produced the result which I am displaying?
> 
> I put the search into a variable at the top of the xslt file:
> 
> <xsl:variable name="bool" 
> select="/responses/response[section/number_sewn &gt; 3]"/>
> 
> 
> And then use it
> 
> <xsl:apply-templates select="$bool">
> 
> 
> I also want to display the search argument on the output, so 
> I know what 
> it was that this output is searching for.
> 
> If I use <xsl:value-of select="$bool"/> I just get the text 
> value of the 
> first element of the selected set. And if I first define the search 
> argument as a string with select="'/responses/...... '" 
> (double-quoting 
> to make it a string, not a node set), I can display that 
> easily enough, 
> but I cannot find a way to make that variable then select a node set.
> 
> Seems so simple, and it is so simple that I cannot find it in the 
> archives. Sorry for such a trivial question.
> 
> Many thanks.
> 
> David Riggs
> 
> Kyoto

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.