xsl-list
[Top] [All Lists]

Empty text area issue

2003-04-23 03:25:49


Hi all, 


Just a warning:  I'm new at this...

I have some xml data being converted into an editable format using html
elements.  

For text elements, I want to turn them into a <textarea> tag.  My xsl is
something like this:

<xsl:template match="some_node">
    <textarea>
        <xsl:value-of select="." />
    </textarea>
</xsl:template>


The problem occurs when the node in question is empty (which is perfectly
valid in my xml).  When this happens, the value-of returns nothing and the
processor truncates <textarea></textarea> to <textarea /> on the way out.
Most browsers choke on this odd looking html.
I know I could switch the output method to html, but these form elements
will nestle themselves inside another xml doc and must be well-formed xml.
If I use html as the output format, elements like
<input type="text" value="foo" /> are converted to the colloquial html
equivalent of
<input type="text" value="foo">
And are no longer well-formed.

Any ideas on how to keep these textareas from being truncated?

Thanks so much,
jk



<Prev in Thread] Current Thread [Next in Thread>
  • Empty text area issue, Jonathan Kart <=