Hi,
I am going bonkers. I have spend the all weekend on this.
My problem only occurs when supplying ctx.getModel() as an org.w3c.dom.Node to
the TrivialViewFactory.
If I have an empty element with an attribute the xslt parser ignore the rest
of xml source.
eg:
Source:
--------
<root>
<element text="the parser stops here"/>
<help>
anything after the <element> is lost during xslt transformation
</help>
</root>
Output:
--------
<root>
<element text="the parser stops here"/>blem only occures when supplieng
ctx.getModel() as an org.w3c.dom.Node
</root>
I am using an XML db (exist-db.org) controller which provide an
org.w3c.dom.Node to the TrivialViewFactory.
The TrivialViewFactory does a
81: Source src = new javax.xml.transform.dom.DOMSource((Node)vctx.getModel());
and forward the src to
343: XSLTransform.java trans.transform(input, res); as the input param.
The vctx.getModel holds the XML DB result-set as a dom.Node. I have checked
the content of vctx.getModel.toString() and it looks perfect.
Here is another example.
an example:
maverick.xml:
----------------
<command name="*">
<!-- This is a controller for the eXist XML db http://exist-db.org -->
<controller class="com.easyspeedy.maverick.ctl.ExistControler">
<param name="xquery" value="xdfs/xquery/test.xq"/>
<param name="ext" value="xml"/>
</controller>
<view type="trivial" name="success">
<transform type="xslt" path="/xdfs/stylesheets/empty.xsl"/>
</view>
</command>
Stylesheet:
------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://xmldream.com/NS/core/1.0">
<!-- This stylesheet does nothing but copy input source to output -->
<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
<xsl:copy>
<xsl:apply-templates
select="@*|*|text()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
XML source WORKING:
---------------
<xd:document xmlns:xd="http://xmldream.com/NS/core/1.0">
<p>This is a text 1</p>
<xd:content>
<p>This is a text 2</p>
<xd:block>
<p>This is a text 3</p>
<!-- xd:usages This element is fine-->
<xd:usages/> <!--This is fine-->
<p>This is a text 4</p>
<xd:body>
<p>This is a text 5</p>
</xd:body>
<p>This is a text 6</p>
</xd:block>
<p>This is a text 7</p>
</xd:content>
</xd:document>
XML WORKING OUTPUT:
This is a text 1
This is a text 2
This is a text 3
This is a text 4
This is a text 5
This is a text 6
This is a text 7
XML Source NOT WORKING:
---------------
<xd:document xmlns:xd="http://xmldream.com/NS/core/1.0">
<p>This is a text 1</p>
<xd:content>
<p>This is a text 2</p>
<xd:block>
<p>This is a text 3</p>
<!-- xd:usages - if the element has an attribute and no child elements it will
stop XSLT processing-->
<xd:usages title="Data Center"/> <!-- Stops here -->
<p>This is a text 4</p>
<xd:body>
<p>This is a text 5</p>
</xd:body>
<p>This is a text 6</p>
</xd:block>
<p>This is a text 7</p>
</xd:content>
</xd:document>
XML NOT WORKING OUTPUT:
This is a text 1
This is a text 2
This is a text 3
--
Med venlig hilsen / Yours sincerely
Peter Lerche
http://easyspeedy.com
_______________________________________
European Dedicated Server Hosting
Extremely low prices, secure, and reliable
Linux and BSD distributions only
_______________________________________
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
[INVALID FOOTER]