Subject: RE: [xsl] using attribute value as an attribute name OR using element value as an attribute name From: ross@xxxxxxxxxxxxx Date: Wed, 18 Sep 2002 11:06:36 -0700 |
David, Hmmm. I'm afraid I don't understand how to implement your idea. I'm a newbie, really. I came up with this to display all columns in the row data regardless of how many there are... <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <table width="95%" class="reporttable" cellpadding="2" cellspacing="2"> <xsl:for-each select="/root/row"> <tr> <xsl:for-each select="@*" > <td> <xsl:value-of select="." /> </td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> ...but this doesn't let me select particular columns as defined by the user. That's really what is going on... the config section is the result of user prefs. I control the format of the config block, but the row tags are straight from SQL Server (for XML RAW). <?xml version="1.0"?> <root> <config> <columnList> <column name="column1"/> <column name="column2"/> <column name="column4"/> </columnList> </config> <row column1="c1r1" column2="c2r1" column3="c3r1" column4="c4r1"/> <row column1="c1r2" column2="c2r2" column3="c3r2" column4="c4r2"/> <row column1="c1r3" column2="c2r3" column3="c3r3" column4="c4r3"/> <row column1="c1r4" column2="c2r4" column3="c3r4" column4="c4r4"/> <row column1="c1r5" column2="c2r5" column3="c3r5" column4="c4r5"/> </root> == Ross == -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of David Carlisle Sent: Wednesday, September 18, 2002 10:10 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] using attribute value as an attribute name OR using element value as an attribute name this would be easier if your columnd data were elements rather than attributes as element order is preserved, but as is, something like <xsl:key name="cols" match="/root/config/columnList/column" use="@name"/> .... <xsl:for-each select="row"> <xsl:for-each selct="@*[key('cols',name())]"> <xsl:sort select="name()"/> ... untested, David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] using attribute value as , David Carlisle | Thread | Re: [xsl] using attribute value as , David Carlisle |
RE: [xsl] RE: XML/XSLT to HTML outp, Passin,Thomas B. (To | Date | RE: [xsl] Limiting a FOR-EACH loop, Gurnam Bedi |
Month |