xsl-list
[Top] [All Lists]

RE: How to Display as text the select predicates of apply-templates

2005-01-20 00:59:29
Hi,

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">

And this works the way you want to?

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 

xsl:value-of will extract the string value of the result of evaluating the 
expression <http://w3.org/TR/xslt#value-of>. In you case, the result is a 
node-set. Extracting the string value of a node-set will retrieve the string 
value of the first element in document order 
<http://www.w3.org/TR/xpath#function-string>. Use e.g. xsl:for-each to go 
throught the node-set bound to $bool, and there extract the value of the 
current node.

Cheers,

Jarno

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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