This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Special characters and XML-to-WML problem



Greetings all,

Here's the problem:

I'm converting an XML file to a WML file

the problem is I have a <A HREF> tag in the XSLT script that I want
to end up looking like this in the WML file:

<A
HREF="http://myserver.com:8001/addItemToOrder?item_name=CPU&order_id=0&user_name=jdoe">

The problem with this is the '&' special characters.  In the XSLT
script, I have to reference them using their entity values: &amp;
I know how to usually get around this problem, which is using
the disable-escape-outputing attribute for either <xsl:text>
ro <xsl:value-of>.  However, this solution only works for text
inside of elements, never for attribute values.  For some reason, 
attributes are immune to escaping special characters.  

I don't want to use <xml:output method="text">, cause this is just
wrong and ugly.

I can use 
<xsl:output method="html" indent="yes" 
doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml" 
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"/>

This does solve that problem, but it creates another.  The DOCTYPE
that appears is:

<!DOCTYPE HTML PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

I want the name of the document type to be WML, not HTML.  With
method="xml", you can do this... but not with method="html".

My final solution is to do the method="html" as done above, but
take out the doctype-system and doctype-public attributes, and just
do a CDATA for the DOCTYPE like this:

<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">]]></xsl:text>

This is least messiest solution that works... however, I still don't
like
it... is there a better way?  Can I escape characters in an attribute?
Any help would be great! Thanks!




-------------------------------------
Michael J. Hudson
Software/Framework Engineer
mhudson@blueprinttech.com

cell-phone: 703.362.8039
voice-mail: 703.827.0638 ext. 4786
fax: 703.734.0987

Blueprint Technologies
"The E-Solution Architect" 
http://www.blueprinttech.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]