Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Question about XSL

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Robert Koberg <rob AT koberg.com>
  • To: David Forslund <forslund AT mail.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Question about XSL
  • Date: Tue, 25 Oct 2005 16:25:18 -0400

David Forslund wrote:
> This didn't seem to work. I can put in some data, but I need to check
> if object is coming in with existing data and not append some text to
> it, as sometimes
> it is already partially completed (in other words, I want to be able to
> edit the information that already exists from a previous time).


You could check first (untested):

>> <xsl:template match="textarea">
>> <textarea xml:space="preserve">
>> <xsl:copy-of select="@*"/>

<xsl:choose>
<xsl:when test="node()">

>> <xsl:apply-templates/>

</xsl:when>
<xsl:otherwise>

<xsl:attribute name="onlclick">emptyMe()</xsl:attribute>
<xsl:text>Enter text</xsl:text>

</xsl:otherwise>
</xsl:choose>

>> </textarea>
>> </xsl:template>


>
> thanks,
>
> Dave
> Robert Koberg wrote:
>
>> David Forslund wrote:
>> > I'm transforming an XML file with an XSLT file to create HTML. When I
>> > use the DOM I get <textarea ...></textarea>
>> > when I use XOM I get <textarea ../> instead. (This is the case when
>> > there is nothing in the textarea to begin with). This is certainly
>> > legitimate xml but browsers fail to terminate the <textarea> element
>> > (Firefox and IE). I've not figured out how to get the <textarea
>> > ...></textarea> to be generated by XOM. (I'm using 1.1b5). Any
>> > suggestions?
>>
>> You could try to put xml:space="preserve" on the source XML or match
>> the the textarea:
>>
>> <xsl:template match="textarea">
>> <textarea xml:space="preserve">
>> <xsl:copy-of select="@*"/>
>> <xsl:apply-templates/>
>> </textarea>
>> </xsl:template>
>>
>> I'd be curious to know if either of those work with XOM.
>>
>> At worst, you could stick in a comment with a space... I usually put
>> in some default text (if empty) and on onclick empty it with
>> javascript for entry.
>>
>> This is a pain in general with outputting XHTML with XSL 1.
>>
>> best,
>> -Rob
>>
>>
>>
>
>





Archive powered by MHonArc 2.6.24.

Top of Page