This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using a parameter to represent an attribute


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?

Many thanks!

Kathryn

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]