multiple xsl:param

Subject: multiple xsl:param
From: YAGOCB <YAGOCB@xxxxxxxx>
Date: Wed, 30 Jun 2004 18:05:56 +0200
Hi all, I'd seen in this thread, that it is posible to pass a xml 
like a XSLT parameter, and then use traditional X-Path syntax
for acces it

----------------------------------------------------------------
Subject: RE: [xsl] multiple xsl:param
From: secam secam <secam2004@xxxxxxxx>
Date: Tue, 18 May 2004 14:13:26 +0200 (CEST)
 

Thanks,

But what i'm lokking for is a way to have a number of
parameter that can increase or decrease in function of
what i send to the transformer.

So, is it possible to have an infinite number of
parameter without writng each parameter in the xsl
code?

Pierre-Alexandre

 --- Michael Kay <mhk@xxxxxxxxx> a icrit : > > In fact
i've seen that the method setParameter
> accepts
> > an object for second parameter
> > So i'm thinking to pass a table as one parameter.
> > 
> > But i don't know how to get back a particular line
> of
> > that table in xsl.
> 
> There's no such thing as a table in the XSLT data
> model.
> 
> But you can represent a table as an XML document,
> and pass that. You can
> then access it using XPath expressions in the usual
> way.
> 
> Michael Kay
------------------------------------------------------------------------
-----

Well, when I try use it:
First I have a definition for the parameter at the top of the XSLT
	<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" 
indent="yes" omit-xml-declaration="yes"/>
	<xsl:param name="listWords" >
		<LITS>
			<LIT id="PROS_R">Advances and delays</LIT>
			<LIT id="PROS_M">Prog. Changed</LIT>
			<LIT id="PROS_A">Prog. Reference</LIT>
		</LITS>			
	</xsl:param>
Then I try to use the param like a node
    <xsl:when test="$listWords/LITS/LIT[@id=$word]">
    
I've got the next error:
    "Cannot use result tree fragment. Error in XPath expresion"
    
and in the "Jeni's XSLT Pages" we can see that

11.1 Result Tree Fragments
 <<Variables introduce an additional data-type into the expression 
language. 
 This additional data type is called result tree fragment. 
 A variable may be bound to a result tree fragment instead of one of 
the four basic XPath 
 data-types (string, number, boolean, node-set). 
 A result tree fragment represents a fragment of the result tree. 
 A result tree fragment is treated equivalently to a node-set that 
contains just a single root node. 
 However, the operations permitted on a result tree fragment are a 
subset of those 
 permitted on a node-set. 
 An operation is permitted on a result tree fragment only if that 
operation 
 would be permitted on a string (the operation on the string may 
involve first converting 
 the string to a number or boolean). In particular, 
 it is not permitted to use the /, //, and [] operators on result tree 
fragments. 
 When a permitted operation is performed on a result tree fragment, it 
is performed exactly as it would be 
 on the equivalent node-set.>>

Who is wrong?  or better, what's that I have not understood ?

Thanks in advance for comments.



Current Thread