[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
syntax differences between match and select patterns
Subject: syntax differences between match and select patterns From: Michel Goossens <Michel.Goossens@xxxxxxx> Date: Sun, 1 Nov 1998 11:15:04 +0100 (MET) |
I read in the XSL (draft) spec (section 2.6) the following about patterns: " A pattern is a string which is matched against an element in the source document. " Then a paragraph down we read: " A pattern that is matched against an element is known as a match pattern. Patterns in xsl:template are match patterns. " And in the next paragraph: " A pattern can also be used to select a list of nodes; a pattern that is used for this is known as a select pattern. In a select pattern, there is a current node which provides a context for the selection. The pattern selects the list of the source nodes that match the pattern. Nodes in the selected list are in document order. Patterns in xsl:process, xsl:for-each and xsl:value-of are select patterns. " So there are two kinds of patterns, match and select patterns. However, what is very much less clear to me is which of the various "matching" syntaxes described in the subsections apply to one and the other. 2.6.1 Alternative Patterns 2.6.2 Matching on Element Ancestry 2.6.3 Anchors 2.6.4 Matching the Root Node 2.6.5 Matching on Element Types 2.6.6 Qualifiers 2.6.7 Matching on Children 2.6.8 Matching on Attributes 2.6.9 Matching on Position For instance, anchors can be used in both (section 2.6.3 states this explicitly), but then I try and use position patterns (2.6.9) in a select pattern (inside a choose pattern), as such <xsl:template match="invitation/body/par"> <xsl:choose> <xsl:when test="body/par[first-of-type()]"> <xsl:process-children/> </xsl:when> <xsl:when test="body/par[last-of-type()]"> <xsl:process-children/> </xsl:when> <xsl:otherwise> <fo:block> <xsl:process-children/> </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template> This does not work, meaning that position matching (and probably a fwe of the other schemes) does not work for select patterns. Only section 2.6.3 and 2.6.8 make explicit reference to select patterns, so I am not sure which syntax is possible where. Thanks for pointing out where the precise syntax rules are explained in the draft spec. Michel Goossens XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
new version of FOP to produce PDFs , James Tauber | Thread | Re: Ugh! accessing current value i, Jeremy CALLES |
new version of FOP to produce PDFs , James Tauber | Date | Re: Ugh! accessing current value i, Jeremy CALLES |
Month |
Keywords