[ https://issues.apache.org/jira/browse/XALANJ-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206897#comment-13206897 ]
Matteo TURRA commented on XALANJ-1906: -------------------------------------- You can do like this: Suppose the content of your testarea is value <textarea id="my_id" name="textareaname"> <xsl:choose> <xsl:when test="not($value/node())"><xsl:value-of select="''"/></xsl:when> <xsl:otherwise><xsl:copy-of select="$value"/></xsl:otherwise> </xsl:choose> </textarea> This way an empty textNode will be output if value have no nodes. > [xhtml output] Empty element form for non EMPTY declared elements > ----------------------------------------------------------------- > > Key: XALANJ-1906 > URL: https://issues.apache.org/jira/browse/XALANJ-1906 > Project: XalanJ2 > Issue Type: Bug > Components: Serialization > Affects Versions: 2.2.0 > Environment: Operating System: All > Platform: All > Reporter: Marco > Priority: Minor > Attachments: > XALANJ-1906-disable-empty-elements-collapsing-2008-10-07.patch > > > - The stylesheet: > > <?xml version="1.0" encoding="UTF-8"?> > > > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > > > <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" > > omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 > Strict//EN" > > doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > > /> > > > > <xsl:template match="/"> > > <html> > > <head> > > <title>bug test</title> > > </head> > > <body> > > <div></div> > > </body> > > </html> > > </xsl:template> > > > > </xsl:stylesheet> > - The output: > > <?xml version="1.0" encoding="iso-8859-1"?> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > > <html> > > <head> > > <title>bug test</title> > > </head> > > <body> > > <div /> > > </body> > > </html> > - The standards: > > Empty-element tags MAY be used for any element which has no content, > > whether or not it is declared using the keyword EMPTY. > > For interoperability, the empty-element tag SHOULD be used, and > > SHOULD only be used, for elements which are declared EMPTY. > (http://www.w3.org/TR/REC-xml/#sec-starttags) > > C.3. Element Minimization and Empty Element Content > > Given an empty instance of an element whose content model > > is not EMPTY (for example, an empty title or paragraph) do > > not use the minimized form (e.g. use <p> </p> and not <p />). > (http://www.w3.org/TR/xhtml1/#guidelines) > - The patch: > Elements like <p> or <div> aren't declared as EMPTY in the XHTML DTD. > According to XML and XHTML standards, the <div></div> form should be used > instead of <div/>. Both are XML (and XHTML) valid, but the second leads to > strange problems with some browsers (guess who --- IE). > Hope this helps, > Marco -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org For additional commands, e-mail: xalan-dev-h...@xml.apache.org