[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL Working draft question
size[attribute(width)] returns the "size" child elements that have an attribute named width; size/attribute(width) returns the "width" attributes of the "size" child elements. Here's how I think of it. A query is an expression that takes an input set of nodes and returns another set of nodes. For a select pattern, the input node set is the current node. For a match pattern, the input node set is the entire set of nodes in the source document and the pattern matches a node if the node is a member of the result of the query. A query of the form "foo" returns the "foo" child elements of the nodes in the input node set. A query of the form "attribute(foo)" returns the "foo" attributes of the nodes in the input node set. The "/" operator does composition. It takes the input node set and applies the left operand to yield another set of nodes; it then uses than as the input set of nodes to the right hand operand; the result of this is the result of the "/" expression. Square brackets do selection. An expression of the form e[b] evaluates b returning a result X and for each node in X evaluates b; it returns the set of nodes from X for which b evaluates to true. b is a boolean expression which is an expression that takes an input set of nodes and returns true or false. Any query can be used as a boolean expression and will evaluate to true if it returns an empty node set. The draft is rather less general than this (for example, it restricts the queries that can be used in boolean expressions within square brackets), but you may find it easier to understand if you think of it in more general terms. James Jeremy CALLES wrote: > > In the 2.7.11.3 paragraph of the XSL WD, Attribute Value Templates is > explain. > > But in the example > > <xsl:define-constant name="image-dir" value="/images"/> > > <xsl:template match="photograph"> > <IMG SRC="{constant(image-dir)}/{href}" > WIDTH="{size/attribute(width)}"/> > </xsl:template> > > With this source > > <photograph> > <href>headquarters.jpg</href> > <size width="300"/> > </photograph> > > I don't understand this match: size/attribute(width) > Normally an attribute should be matched by the command > size[attribute(width)], > according to the 2.6.8 paragraph. > > Is it a typo or a new mean of matching attributes especially for > Attribute Value Templates. > > Thanks > -- > Jeremy CALLES --- jcalles@xxxxxxxxxx > home page --- http://www.mygale.org/07/jcalles > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|