RE: [xsl] Pipe Question

Subject: RE: [xsl] Pipe Question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 9 Jun 2005 09:43:37 +0100
> If defined like this:
> <xsl:param name="my_param" select="/"/>
> 
> Or this:
> <xsl:param name="my_param" select="."/>
> 
> And the param "my_param" is not supplied you will end up with a copy
> of the document source "/" or current context "." (respectively).  Do
> I have this correct?

No, you don't get a copy, you get the original.
> 
> $match is a parameter for one of my templates.  The intent of the
> template:  SELECT ALL -or- SELECT ALL where @component = $match.
> 
> In this example:
> <xsl:template match="X[@component=$match] | 
> X[not(@component=$match)]"/>
> 
> Select ALL X elements who's @component is one of the $match elements
> -OR- when $match does not exist, SELECT ALL. 

If a variable doesn't exist, you get an error. For any condition,

match="X[condition] | X[not(condition)]"

is equivalent to

match="X"

except in the special case where evaluating the condition causes an error.

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

Current Thread