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

Can't get the value of an attribute in an xsl:param

Subject: Can't get the value of an attribute in an xsl:param
From: John Sands <WonkoWatson@xxxxxxxxx>
Date: Thu, 24 Jul 2003 10:57:27 -0400
xsl param c
I have an XML document that has a set of "question" elements, each of
which has an "answer_scheme_id" attribute:

 <questions>
  <question name="How well did Agent listen?" answer_scheme_id="4" />
  ...
 </questions>

Elsewhere in the document is a set of answer_scheme elements that
each contain the details of the type of question and how it is displayed:

 <answer_schemes>
  <answer_scheme name="yes or no" max_score="5" type="boolean" format="radioh"/>
  ...
 </answer_schemes>

I have a template for processing the questions, and I call it in two
ways: in one way (that is working fine) I have just one question in
the XML document and I pass in a parameter (from C# code) that contains the
answer_scheme element. In the other way, I process the whole form, so
the question template file is included in the form template file. In
this situation, I do not pass in the answer_scheme node, so the param
is empty and I want the template to find the answer_scheme node
itself. If I hard code a value for answer_scheme_id it works:

 <xsl:variable name="answer_schemes" select="/form/answer_schemes/answer_scheme" />
 <xsl:template match="question">
    <xsl:param name="answer_scheme" select="$answer_schemes[position()=1" />

I'm so close! All I need to do is find a way to use the
answer_scheme_id attribute instead of that hard-coded '1'. But this
doesn't work:

    <xsl:param name="answer_scheme" select="$answer_schemes[position()=@answer_scheme_id]" />

Is there some reason I can't get the value of the attribute in the
param element? I know the attribute is there because I do a value-of
right after the parameters.

Thanks for any suggestions,
John Sands



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


Current Thread

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.