Subject: [xsl] WG: Display attribute inside an xsl:for-each-group loop From: "Prerovsky, Clemens" <Clemens.Prerovsky@xxxxxxx> Date: Thu, 23 Jun 2005 08:54:35 +0200 |
Hi guys, I'm stuck (once again ;) with an XSL problem and I hope someone knows how to solve it. I'm looping through my XML structure which looks like <root> <sub_A> <node_A myattr="33533"/> <node_B>textual content</node_B> <node_B/> <node_C/> <node_D>textual content</node_D> <node_D myattr="1234567"/> <node_D/> </sub_A> <sub_B> ... </sub_B> </root> using a xsl:for-each-group loop because I want to display groups of node names with a single header. The result should look like node_A 33533 node_B textual content node_C node_D textual content 1234567 As you can see contents are stored inside a text node or an attribute which is called "myattr". My loop construct looks like: 1 <xsl:for-each-group select="/root/sub_A/*" group-adjacent="node-name()"> 2 <xsl:value-of select="name()"/> 3 <xsl:for-each select="current-group()"> 4 <xsl:value-of select="text()" /><xsl:value-of select="@myattr/text()" /> 5 </xsl:for-each> 6 </xsl:for-each-group> Line 4 is of special interest - thats where the contents should :) be displayed. While <xsl:value-of select="text()" /> works fine, <xsl:value-of select="@myattr/text()" /> produces an error in the XSL-parser: Warning: on line 65 of file:/srv/www/htdocs/bka/./tmp/evaluations/42ba56a40e38d.xsl: The child axis starting at an attribute() node will never select anything I'm using Saxon-B 8.0 working on a XSLT 2.0 stylesheet. Hope anybody can figure this out. Best regards - many thanks for your help! Clemens Prerovsky
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT2 grouping over multi, Thomas J. Sebestyen | Thread | RE: [xsl] WG: Display attribute ins, Michael Kay |
RE: [xsl] Finding parent of the mid, Michael Kay | Date | [xsl] xsl looping 2 siblings help, -= jay =- |
Month |