On Wed, 23 Apr 2003, Jonathan Kart wrote:
>
>
> 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?
I'm sure others will have better ideas, but you could just put
an <xsl:text> </xsl:text> in, couldn't you?
-James
---
Dr James Cummings, Oxford Text Archive, University of Oxford
James dot Cummings at ota dot ahds dot ac dot uk
|