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

Re: xml not well-formed

Subject: Re: xml not well-formed
From: George Cristian Bina <george@xxxxxxxxxxxxx>
Date: Sun, 08 Jan 2006 12:00:41 +0200
xslt transform not well formed
Hi Dan,

This is one of the basic questions with XSLT. You can have XPath expressions inside an attribute value if you enclose them in curly braces, in your case that will be:

<div id="{Location}"><xsl:value-of select="Name"/></div>

Look for attribute value template in the XSLT spec for more details.

You can specify an attribute also with xsl:attribute:
<div>
<xsl:attribute name="id"><xsl:value-of select="Location"/></xsl:attribute>
<xsl:value-of select="Name"/>
</div>


Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


dan@xxxxxxxxxxxxx wrote:
In the below example, I would like to make the div id = <xsl:value-of
select="Location"/>, but this will not work since it is not well-formed
xml. Is there any way to reference this node without using an xml element?

Thanks,
Dan

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
     <xsl:for-each select="songlist/song">
        <div id="<xsl:value-of select="Location"/>"><xsl:value-of
select="Name"/></div>
     </xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

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.