Subject: Re: [xsl] Column widths From: Mike Brown <mike@xxxxxxxx> Date: Sat, 22 Jun 2002 11:54:53 -0600 (MDT) |
> XPath seem to suggest a syntax with [ and ] for attributes Brackets indicate predicates. Think of them as filters, providing everything to the left of them, for which everything inside them is true. If all that is inside them is a number (or an expression that evaluates to a number), then it is shorthand for [position()=$num]. > <xsl:variable name="x" select="position()"/> $x will be the position of the current node, relative to the entire set of nodes that was selected for processing via xsl:apply-templates or xsl:for-each, after they've been ordered depending on the axis of that original selection and any xsl:sort instructions (usually, document order by default). > <xsl:if test="ancestor::table//col[$x]/attribute::width"> You are testing for the existence of any 'width' attributes of all 'col' elements for which $x is true $x is a number in this case, so you will get the 'col' element at position $x from among the set of 'col' elements descended from the set of all 'table' elements in the set of all ancestors It's hard to tell you what the correct answer is, without seeing your XML and the part of the stylesheet where you selected the nodes that make position() meaningful. - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Column widths, Gustaf Liljegren | Thread | Re: [xsl] Column widths, Gustaf Liljegren |
[xsl] Column widths, Gustaf Liljegren | Date | [xsl] String Manipulation, Joel Konkle-Parker |
Month |