C
cameron
I have a method that contains the following:
--------------8<------ CODE ------>8--------------
Document XSL_XML =
XMLUtility.XMLDocument(sc.getRealPath("/XSLT/DirContents.xslt"));
DOMSource XML = new DOMSource(DirXML);
DOMSource XSL = new DOMSource(XSL_XML);
//return(XMLUtility.XMLToString(XSL_XML, true, 4));
StreamResult theTransformationResult = new StreamResult( new
ByteArrayOutputStream() );
Transformer theTransformer =
TransformerFactory.newInstance().newTransformer( XSL );
theTransformer.setOutputProperty(
"{http://xml.apache.org/xslt}indent-amount", "4" );
theTransformer.transform( XML,
theTransformationResult );
return theTransformationResult.getOutputStream().toString();
--------------8<------ CODE ------>8--------------
It keeps blowing up with a:
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: stylesheet
requires attribute: version
but the XML document that is the stylesheet is good:
--------------8<------ CODE ------>8--------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" indent="yes"/>
<xslaram name="ShowDirs" value="no"/>
<xslaram name="ShowImgs" value="no"/>
<xsl:template match="/Directory">
<xsl:for-each select="Entry">
<xsl:value-of select="@Filename"/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
--------------8<------ CODE ------>8--------------
(the commented out return shows the XML is as expected),and
contains the version attribute. I haven't been able to
serialize the DOMSource to check to see if the XML is in
there as expected.
Does anyone see what I am missing?
Thanks
-Cam
--------------8<------ CODE ------>8--------------
Document XSL_XML =
XMLUtility.XMLDocument(sc.getRealPath("/XSLT/DirContents.xslt"));
DOMSource XML = new DOMSource(DirXML);
DOMSource XSL = new DOMSource(XSL_XML);
//return(XMLUtility.XMLToString(XSL_XML, true, 4));
StreamResult theTransformationResult = new StreamResult( new
ByteArrayOutputStream() );
Transformer theTransformer =
TransformerFactory.newInstance().newTransformer( XSL );
theTransformer.setOutputProperty(
"{http://xml.apache.org/xslt}indent-amount", "4" );
theTransformer.transform( XML,
theTransformationResult );
return theTransformationResult.getOutputStream().toString();
--------------8<------ CODE ------>8--------------
It keeps blowing up with a:
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: stylesheet
requires attribute: version
but the XML document that is the stylesheet is good:
--------------8<------ CODE ------>8--------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" indent="yes"/>
<xslaram name="ShowDirs" value="no"/>
<xslaram name="ShowImgs" value="no"/>
<xsl:template match="/Directory">
<xsl:for-each select="Entry">
<xsl:value-of select="@Filename"/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
--------------8<------ CODE ------>8--------------
(the commented out return shows the XML is as expected),and
contains the version attribute. I haven't been able to
serialize the DOMSource to check to see if the XML is in
there as expected.
Does anyone see what I am missing?
Thanks
-Cam