[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
From: Kathryn.Grant@xxxxxxxxxxxxxxxxx Date: Mon, 19 Aug 2002 10:21:07 -0700 |
Hi Dimitre (and everyone), I really appreciate your answer. Unfortunately, I tried it and it didn't work. The browser doesn't give me any kind of error message. The HTML in the stylesheet shows up fine, but none of the XML data shows up. When I take out the parameter and just type in the attribute, e.g., <xsl:for-each select="//brpfields/record[@S3G >'0']"> <xsl:sort data-type="number" select="@S3G"/> The transformation works correctly. Any other ideas? I am fairly new to XSL and I always seem to want to do something that is one step ahead of my ability :) But I guess that's a good way to learn. Thanks again-- Kathryn Date: Fri, 16 Aug 2002 22:37:01 -0700 (PDT) From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Subject: [xsl] Re: Using a parameter to represent an attribute - --- Kathryn dot Grant at freight dot fedex dot com wrote: > Hi all, > > I'm stuck. I'm sure this is very simple, but I've been searching my > XSL > books and the web and can't find an answer. > > Here's my original XSL, in which I select and sort based on the S3G > attribute of the <record>. > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; > version="1.0"> > > <xsl:output method="html"/> > > <xsl:template match="/"> > <TABLE border="1" width="90%" style="font-size:10pt" cellpadding="0" > cellspacing="0"> > <tr valign="top"> > <th width="16%"><b>Field Name</b></th> > <th width="42%"><b>Description</b></th> > <th width="42%"><b>Entry Detail</b></th> > </tr> > <xsl:for-each select="//brpfields/record[@S3G >'0']"> > <xsl:sort data-type="number" select="@S3G"/> > etc. etc. > > > > I want to use a parameter in place of S3G (Ultimately I'll be passing > the > value from an external javascript). So I tried this: > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; > version="1.0"> > <xsl:param name="param1" select="S3G"/> > > <xsl:output method="html"/> > > <xsl:template match="/"> > <TABLE border="1" width="90%" style="font-size:10pt" cellpadding="0" > cellspacing="0"> > <tr valign="top"> > <th width="16%"><b>Field Name</b></th> > <th width="42%"><b>Description</b></th> > <th width="42%"><b>Entry Detail</b></th> > </tr> > <xsl:for-each select="//brpfields/record[@$param1 >'0']"> > <xsl:sort data-type="number" select="@$param1"/> > > But the transformation chokes on the $. I've tried various > permutations of > quotes; I've tried braces; I've tried everything I can think of. Why > doesn't it like the parameter for the <record> attribute value? Hi Kathryn, Use: <xsl:for-each select="//brpfields/record[@*[name()=$param1] >'0']"> <xsl:sort data-type="number" select="@*[name()=$param1]"/> .......... </xsl:for-each> I find the following a little bit simpler: <xsl:for-each select="//brpfields/record/@*[name()=$param1][. >'0']"> <xsl:sort data-type="number" select="."/> .......... </xsl:for-each> ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] netscape problems with ce, Kimberly Hahn | Thread | [xsl] Re:, Jeni Tennison |
Re: [xsl] sum and substring xpath n, Joerg Heinicke | Date | Re: [xsl] DOM and XML parser, Jeni Tennison |
Month |