[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Column widths
> 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
|
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
|