xsl-list
[Top] [All Lists]

Re: Pipe Question

2005-06-07 21:51:41
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[(_at_)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[(_at_)component=$match] | X[not(@component='$match')]"/>


I don't understand:
 <xsl:apply-templates select=
   "$yourNodeSet[$match][(_at_)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(_at_)gmail(_dot_)com> wrote:
On 6/8/05, Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com> 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.


[(_at_)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][(_at_)sComponentObjectName=$match]
  |
    $yourNodeSet[not($match)]
  "/>


Cheers,
Dimitre Novatchev

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>