[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[no subject]

From: Kathryn.Grant@xxxxxxxxxxxxxxxxx
Date: Mon, 19 Aug 2002 10:21:07 -0700
[no subject]
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:  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
  • [no subject]
    • Kathryn . Grant - Mon, 19 Aug 2002 13:20:22 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.