 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 19th, 2009, 04:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
An XML value in an Html tag (xslt)
Good day,
I need to use an Xml value in an Html tag (xslt) :
<inputid="btnDone"type="button"value="{@Description}"onClick="{@name}.click()"
the onClick="{@name}.click()" works but i would like to insert the value in the id & value
I tried {@Description} & @Description but no luck
Please help
|
|

October 19th, 2009, 04:45 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
Who knows. It depends entirely on what your XML looks like.
|
|

October 19th, 2009, 04:53 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
<xsl:value-ofselect="Description"disable-output-escaping="yes" />
<xsl:attributename='id'><xsl:value-ofselect='@name' /></xsl:attribute>
Please Assit!
|
|

October 19th, 2009, 05:00 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
That is your XSLT, not your source XML.
You do realise that the '@' symbol means 'attribute' - there fore if 'Description' is not an attribute then you don't need the '@'.
|
|

October 19th, 2009, 05:17 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
There's nothing intrisically wrong with the XSLT code you've shown. If it's not working, that's because it doesn't match your XML, which you haven't shown us. It's also important to know what the context node is at the time the code is evaluated.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

October 19th, 2009, 05:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
sorry not to sure how though.
that's the code i want to reference within the xslt file and use within HTML tag!
please help
|
|

October 19th, 2009, 05:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
<xsl:iftest="$cTrigger > '1'">
<xsl:for-eachselect="Activity/ObjectGroup[@type='trigger']/Object">
<trstyle="display:none;">
<tdcolspan="4"style="visibility: hidden; height: 0px;">
<xsl:elementname="asp:CheckBox">
<xsl:attributename='id'><xsl:value-ofselect='@name' /></xsl:attribute>
<xsl:attributename='runat'>server</xsl:attribute>
<xsl:attributename='GroupName'>triggers</xsl:attribute>
<xsl:iftest="Value[. = 'on']">
<xsl:attributename='Checked'>True</xsl:attribute>
</xsl:if>
</xsl:element>
</td>
<td><inputid="btnDone"type="button"value="{@name}"onClick="{@name}.click();"></input>
</td>
</tr>
</xsl:for-each>
</xsl:if>
Please help
|
|

October 19th, 2009, 07:13 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Hi,
<xsl:value-ofselect="Description"disable-output-escaping="yes" />
<xsl:attributename='id'><xsl:value-ofselect='@name' /></xsl:attribute>
This works: value="{@name}"
But not: value="{@Description}"
Please help
|
|

October 19th, 2009, 07:16 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
You still haven't shown us your SOURCE XML.
And have you tried value="{Description}"
|
|

October 19th, 2009, 07:27 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thank You :)
works great:
<inputid="{Description}"type="button"value="{Description}"onClick="{@name}.click();">
Thank You All for helping :)
|
|
 |