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

How to overrite default rendering toretain name=value

Subject: How to overrite default rendering toretain name=value attribute pairs
From: "Karlmarx Rajangam" <karlmarx.rajangam@xxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jun 2007 08:35:19 -0400
 How to overrite default rendering toretain  name=value
I have a problem. Basically I want to get an output with selected="true"
for <option/>, instead of WITHOUT "true". Even though <option selected/>
is a valid html, I need to get name=value pair (selected=true) as we try
to form & pass an XML input for some other validation.

We must create something like,
<choice>
	<option selected = "true">cc</option>
	<!-- NOT THIS WAY <option selected>cc</option> -->
	<option>bbb</option>
</choice>

Tried 2 ways:(A)
<xsl:for-each select="OPTION">
inputXML += '<option>
	<xsl:if test="@SELECTED='true'"><xsl:attribute
name="Selected">true</xsl:attribute></xsl:if><xsl:value-of select="."/>
</option>\n';
</xsl:for-each>

Results in <option selected>xxx</option>, without ="TRUE" thereby
becoming an INVALID XML

So, I tried (B),
<xsl:for-each select="OPTION">
<xsl:choose>
	<xsl:when test="@SELECTED='true'">inputXML += '&lt;option
selected="true"&gt;<xsl:value-of
select="."/>&lt;/option&gt;\n';</xsl:when>
	<xsl:otherwise>inputXML += '<option><xsl:value-of
select="."/></option>\n';</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

thinking &lt; will be rendered a <, but resulted only as
&lt;option selected="true"&gt;xxx&lt;/option&gt;

Any suggestion how I can fix this?

Thanks in advance,
karl

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.