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

Re: Pipe Question

Subject: Re: Pipe Question
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Fri, 10 Jun 2005 08:04:04 -0700
pipe select
I recently tried the following select for a param within a template
rule and it worked fine:

<xsl:param name="my_param" select="adfasdfijasdflkjsfs"/>

I thought that the param would be an empty set since the select was
"garbli-gook" and expected the select to fail against the supplied
list for the parameter, but indeed it was the entire supplied list for
the parameter.  This does increase my understanding of the param.  If
no value/list supplied for the param use the select.  The select does
not initialize/filter the param in any way.  Correct?

> No, you don't get a copy, you get the original.
Thanks for clarifying that.  However, nobody still has answered the question:

How do you write the select for a parameter to default to empty, not
the original source?  (I guess you could: select="garbli-gook")
So, a parameter within a template.  This parameter must evaluate to an
empty node-set when not supplied since later node test will be
peformed against the param.

On 6/9/05, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > 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

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.