[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: union operator and predicates in XSLT patterns
I missed mentioning that a predicate can contain any expression, so a sequence expression *is* allowed in the predicate of an expression used in a match. Note that the terminology used is that a "pattern" is that subset of XPath expressions suitable for use in a match expression. See XSLT 2 Section 5.5.2 for what is allowed in a pattern: http://www.w3.org/TR/2007/REC-xslt20-20070123/#pattern-syntax I hope this helps. . . . . . . . Ken At 2011-01-24 12:13 -0500, I wrote: >At 2011-01-24 17:06 +0000, HILLMAN, Tomos wrote: >>Hi; just a quick query for my own understanding. Apologies if I've >>gotten the wrong list. > >XSLT and XPath questions would be better posted to the following list: > > http://www.mulberrytech.com/xsl/xsl-list > >There are a number of subscribers who would enthusiastically respond >to such questions. > >>I wanted to use both a union and operator in an XLST template, i.e. >>match="(div1|div2)[not(@role)]" (simplified). > >Nope ... not allowed ... the parentheses grouping the union is not allowed. > >You have to write the above as: > > match="div1[not(@role)] | div2[not(@role)]" > >>This is, I think, equivalent in XPath 2.0 as >>"/*//(div1|div2)[not(@role)]", which I would expect to follow the >>rule for patterns in XSLT (the node $N matches pattern PAT if $N is >>a member of expression "root($N)//(PAT)". However, this shows as invalid. >> >>Can someone explain this to me? :) > >Simple restriction of the syntax. The parentheses are a sequence >operator, in effect creating the sequence of the union of div1 and >div2. Sequences are not allowed in match patterns. > >Sequences are, of course, available to use in select= expressions. > >I hope this helps. > >. . . . . . . . . Ken -- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/ G. Ken Holman mailto:gkholman@CraneSoftwrights.com Legal business disclaimers: http://www.CraneSoftwrights.com/legal
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|