You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by greg keraunen <gk...@valinux.com> on 2000/08/31 00:30:50 UTC

cannot force generation of " inside attribute value string

dear friends,

I am having a problem producing xml output that includes double-quotes
inside of an attribute value.
Quotes are always converted to &quot;, even when I try to use CDATA
sections or <xsl:text disable-output-escaping="yes">.
It does not matter what output mode I use: XML or HTML, the problem
persists.

This is what I want:
 <input type="text" name="vg_answer.qa[1]" value="<?php echo global_get(
"vg_answer.qa[1]" ); ?>">  

This is what I am getting:
 <input type="text" name="vg_answer.qa[1]" value="<?php echo global_get(
&quot;vg_answer.qa[1]&quot;; ) ?>">  

I know I could hack around this problem by generating the <input>
element as a <xsl:text> element instead of letting it go into the output
tree as and <input> element. But that won't work in this application
because I need to set the value attribute of the <input> element using
<xsl:attribute> and copy all of the other pre-existing attributes from
the input xml file.

Any ideas?

-- 
greg keraunen <gk...@valinux.com> 408-542-8600 x8085
web software engineer

RE: cannot force generation of " inside attribute value string

Posted by Ed Staub <es...@mediaone.net>.
You're trying to create output which isn't well-formed XML.
No XML parser will be able to read it.

If you don't intend the output to be XML, set the output method to text:
	<xsl:output method="text"/>

This may break other things though; if you really want XML, I'd change the
output schema, if possible.  In particular, you might change it to something
like:

<input type="text" name="vg_answer.qa[1]">
	<value type=processing-instruction>
		php echo global_get("vg_answer.qa[1]" );
	<value/>
<input/>

Since I don't know the details of what you're doing, there may be a much
better schema.

-Ed Staub

-----Original Message-----
From: greg@valinux.com [mailto:greg@valinux.com]On Behalf Of greg
keraunen
Sent: Wednesday, August 30, 2000 6:31 PM
To: xalan-dev
Cc: James Byers
Subject: cannot force generation of " inside attribute value string


dear friends,

I am having a problem producing xml output that includes double-quotes
inside of an attribute value.
Quotes are always converted to &quot;, even when I try to use CDATA
sections or <xsl:text disable-output-escaping="yes">.
It does not matter what output mode I use: XML or HTML, the problem
persists.

This is what I want:
 <input type="text" name="vg_answer.qa[1]" value="<?php echo global_get(
"vg_answer.qa[1]" ); ?>">

This is what I am getting:
 <input type="text" name="vg_answer.qa[1]" value="<?php echo global_get(
&quot;vg_answer.qa[1]&quot;; ) ?>">

I know I could hack around this problem by generating the <input>
element as a <xsl:text> element instead of letting it go into the output
tree as and <input> element. But that won't work in this application
because I need to set the value attribute of the <input> element using
<xsl:attribute> and copy all of the other pre-existing attributes from
the input xml file.

Any ideas?

--
greg keraunen <gk...@valinux.com> 408-542-8600 x8085
web software engineer