Subject: Re: [xsl] RE: unbelievable often asked question From: Mike Brown <mike@xxxxxxxx> Date: Thu, 2 Jan 2003 11:38:50 -0700 (MST) |
Hubert Holtz wrote: > I often visit tutorial-sites to get my informations (and now this great > mail-list) and there was no "and", only a | for or. "|" never really means "or". In an XSLT pattern, which is what goes in a "match" attribute, it's just a separator between node tests when used in a pattern. Depending on how you like to interpret your code into English, you might use the words "or" or "and" informally. For example, <xsl:template match="foo|bar"> says this template is a good match for a node that matches the test foo (element named foo in no namespace), and it is also a good match for a node that matches the test bar (element named bar in no namespace). Since a programmer might be used to reading "|" as "or", it would be just as correct to say "this template is a good match for a foo or a bar". In an XPath expression, "|" is a set union operator. In mathematics, a set is an unordered group of values, typically written (in math, not XPath) as a comma-separated list inside curly braces: {1,2,3,4}. Order doesn't matter. The union of two sets is the result of merging them and eliminating duplicates. The union of {1,2,3,4} and {2,3,5} is {1,2,3,4,5}. In XPath, it works the same way with nodes. select="foo|bar" means to use the union of the node-set {all child::foo elements} and the node-set {all child::bar elements}, producing the node-set. Note that I'm mixing notations here; there are no curly braces in XPath, and in XSLT they are only used in XSLT Attribute Value Templates to delimit XPath expressions embedded in literal attribute values. Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSLT2 tools, Michael Kay | Thread | Re: [xsl] RE: unbelievable often as, Wendell Piez |
RE: [xsl] Re: How to output open/cl, Passin, Tom | Date | Re: [xsl] RE: unbelievable often as, Wendell Piez |
Month |