[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: Tue, 7 Jun 2005 21:51:41 -0700
pipe matches
If match is "A" and "B" like this:

Then the following will match X who's component attributes is either
an "A" or "B" value:

<xsl:template select="X[@component=$match]"/>

And if the parameter match is not supplied, then the following will
match all X who either have or do not have a component attribute that
matches match:

<xsl:template select="X[@component=$match] | X[not(@component='$match')]"/>

I don't understand:
>  <xsl:apply-templates select=
>    "$yourNodeSet[$match][@sComponentObjectName=$match]
Specifically the first predicate $match, followed the the next
predicate.  I don't understand the how/why of that.

Also, I question the param *default* select.  I don't understand how
(and using the match param as an example) to write the select in such
a way that I would not be selecting the doc source.  So:

<xsl:template match="X">
<xsl:param name="match" select="/"/>

If this above template rule aplies, but no match param has been
passed, the match becomes the document source?  This does not work for
me... I need this select to either evaluate to the "root" of the RTF
passed into match or nothing.  For 2 reasons (1) XSLT1.0 requires that
you supply a "select" if you plan on treating the param as a node-set
later and (2) I may not know or care of the actual structure of the
node-set passed.  There was one more point, but it slipped my mind.
If I recall, I will follow up.


On 6/7/05, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> On 6/8/05, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> > How could I use a pipe for this predicate to specifiy the inclusion of
> > ALL where $match does not exist (is empty)?
> What is "a pipe for a predicate"?
> XPath certainly does not define such thing.
> >
> > [@sComponentObjectName=$match]
> >
> > This written out verbose would be:
> >
> > <xsl:choose>
> >  <xsl:when test="$match">
> >     ... apply-templates with above predicate ...
> >  </xsl:when>
> >  <xsl:otherwise>
> >    ... apply-templates without above predicate ...
> >  </xsl:otherwise>
> > </xsl:choose>
> The abbreviated form of the above (if I understand it well) is:
>  <xsl:apply-templates select=
>    "$yourNodeSet[$match][@sComponentObjectName=$match]
>   |
>     $yourNodeSet[not($match)]
>   "/>
> Cheers,
> Dimitre Novatchev

Current Thread


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.
First Name
Last Name
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.