Subject: Re: [xsl] Hopefully not a terribly silly question From: Trevor Nash <tcn@xxxxxxxxxxxxx> Date: Thu, 03 Jan 2002 19:03:20 +0000 |
Morgan, You are trying to fish out the column name every time you need it. Better to make a list of them once in a global variable: <xsl:variable name="col-names" select="/result/row[1]/column/@name" /> <!-- that gives you a node-set with the name attributes in document order --> Then instead of > <xsl:value-of select="concat('/result/row[1]/column[', position(),']/@name')"/> try <xsl:variable name="col-no" select="position()" /> <xsl:value-of select="$col-names[$col-no]" /> to give you the name of the current column. (Don't put position() directly, because it changes its value according to the context). >Unfortunately, I get a the literal string result of the concat() >function, instead of the actual data value. Is there some sort of >eval() function that I need to use? Am I approaching this incorrectly? > I know that XSL is quite a paradigm shift from traditional programming >methods. True. You can improve this a lot by letting templates do the work for you instead of explicitly navigating the source tree. I also think you are going to miss the first row of data: you want to print the column headings *and* the values on the first row, not just the names. There isn't a standard 'eval' function BTW, though some processors have it as an extension function. Regards, Trevor Nash -- Traditional training & distance learning, Consultancy by email Melvaig Software Engineering Limited voice: +44 (0) 1445 771 271 email: tcn@xxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Hopefully not a terribly , Wendell Piez | Thread | [xsl] dtd2xsl and xml2xsl, Bryan Schnabel |
Re: [xsl] The evaluate function, Trevor Nash | Date | RE: [xsl] The evaluate function, Evan Lenz |
Month |