Subject: Re: [xsl] Pipe Question From: Karl Stubsjoen <kstubs@xxxxxxxxx> Date: Wed, 8 Jun 2005 00:25:59 -0700 |
Sorry, don't mean to be vague, my fault. Thanks for the help thus far. I guess it is hard to ask the questions sometimes... Karl.. On 6/7/05, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote: > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Pipe Question, Dimitre Novatchev | Thread | Re: [xsl] Pipe Question, David Carlisle |
Re: [xsl] Creating <!DOCTYPE in the, Mukul Gandhi | Date | [xsl] Processing Efficiently, Karl Stubsjoen |
Month |