Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old October 19th, 2009, 04:39 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question 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
 
Old October 19th, 2009, 04:45 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Who knows. It depends entirely on what your XML looks like.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old October 19th, 2009, 04:53 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

<xsl:value-ofselect="Description"disable-output-escaping="yes" />
<
xsl:attributename='id'><xsl:value-ofselect='@name' /></xsl:attribute>

Please Assit!
 
Old October 19th, 2009, 05:00 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

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 '@'.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old October 19th, 2009, 05:17 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old October 19th, 2009, 05:49 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

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
 
Old October 19th, 2009, 05:54 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

<xsl:iftest="$cTrigger &gt; '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
 
Old October 19th, 2009, 07:13 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question

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
 
Old October 19th, 2009, 07:16 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You still haven't shown us your SOURCE XML.

And have you tried value="{Description}"
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old October 19th, 2009, 07:27 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Wink

Thank You :)

works great:
<
inputid="{Description}"type="button"value="{Description}"onClick="{@name}.click();">

Thank You All for helping :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding xml-html transformation of an xml string using xslt and javascript suprakash444 XSLT 1 January 12th, 2009 01:23 AM
html to xml convertion using xslt moshaik BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 2 November 24th, 2008 10:33 AM
How do I transform XSLT without the <?xml?> tag? nadavvin XSLT 4 June 10th, 2007 09:25 AM
How to force XSLT to output a close tag in XML? richcon XSLT 2 June 29th, 2006 02:39 AM
how to get xml tag names in xslt mdawoodk XSLT 8 March 14th, 2005 05:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.