Re: [xsl] Pipe Question

Subject: Re: [xsl] Pipe Question
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 8 Jun 2005 16:50:52 +1000
Sorry,
I completely can't understand what you're saying.

In my previous reply I posted the code that did exactly what you
seemed to be wanting.


Cheers,
Dimitre.

On 6/8/05, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> So,
> If match is "A" and "B" like this:
> <match>A</match>
> <match>B</match>
>
> 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.
>
> Thanks,
> Karl..
>
>
> 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