Subject: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Document summary using xs, Rob Anderson | Thread | Re: [xsl] Can't get the value of an, Jeni Tennison |
Re: [xsl] alignment of a leader in , G. Ken Holman | Date | Re: [xsl] Can't get the value of an, Jeni Tennison |
Month |