BaseXdb/basex — Issue #419: XSLT Transformer and HTML Output
Author: mikehawkes
Created: 2012-03-06 10:13:39+00:00
State: open

I have some PHP code that constructs a query and an associated transformer:

$input = "let \$qry := " .
str_replace( $toReplace, $with, $queryText ) .
"return xslt:transform( {\$qry}, \$tformer)";

The transform kicks in and transforms the result of the query, however, I can't get it to output an text area HTML tag properly. It looks like the transform can't output a blank item - so, doing a simple:

print $query->execute( $input );

Returns a page that fails to render properly if it includes a textarea tag. I even tried inserting a non-breaking space, but that fails - it's almost as if the transformer runs twice.

I have tried setting the transformer xsl:output option to HTML ... and that seems to have no effect. At the moment I'm having to set a default value of 'Default' into each text area and then write code to remove it when bringing it back into the database. In effect, I have to do this for every text area, then on input, strip any whitespace and then remove the default text ...

```	Additional information

<xsl:if test="not(additionalInformation/text())">Default</xsl:if>
<xsl:value-of select="additionalInformation/text()"/>

```

Any thoughts welcome.

Thanks in advance
Mike