xsl-list
[Top] [All Lists]

Re: [xsl] transforming from xml to JSF (java server faces)

2006-05-18 00:08:44
Hi John,

If you use the text output method then you need to emit the tags as text to the output that means you need to escape < to &lt; and instead of <html> for instance write &lt;html>.

In XSLT 2.0 you can use character maps, for instance

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
  <xsl:character-map name="percentAt">
    <xsl:output-character character="#" string="&lt;%"/>
    <xsl:output-character character=">" string=">"/>
  </xsl:character-map>
  <xsl:output method="xml" use-character-maps="percentAt"/>
  <xsl:template match="/">
#@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<test></test>
  </xsl:template>
</xsl:stylesheet>


will give:

<?xml version="1.0" encoding="UTF-8"?>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<test/>

Of course you can emit that to the output if you use disable output escaping in XSLT 1.0, but that is not recommended in general, only as the last possible solution:

<xsl:text disable-output-escaping="yes">&lt;%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %></xsl:text>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


John Burgess wrote:
I'm trying to transform an XML file that describes a database schema into a set of jsf files to display the data.
The problem I have is with the initial
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
tag and others like it.

I've put the lines in a CDATA section so they can exist in the stylesheet but if I set the output type to html then I get
&gt; %@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %&lt;
which is no good.

If I use output method text then subsequent <html> and all other tags are quietly omitted.

If I use output method xml then I get the same as html.

How should I deal with this?






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>