Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > XSL transform error

Reply
Thread Tools

XSL transform error

 
 
Xiaolei Li
Guest
Posts: n/a
 
      01-24-2005
first off, i'm a total newbie at this XSL stuff so excuse any wrong
usage of terminology or whatever else.

i have a XSL to transform a Document such that all "text" nodes will
have a "SPAN" inserted around it. the XSL is given below:

<xsl:transform version="1.1"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xhtml" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="text()" priority="2">
<span lx="" ly="" ux="" uy="">
<xsl:copy/>
</span>
</xsl:template>

<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:transform>

so basically, i parse a HTML page into a Document using nekoHTML and
then run that Document through this XSL. this is all accomplished in
Java (1.4.2_06) using the javax.xml.transform.Transformer class. the
code is something like this:

Transformer transformer = tf.newTransformer(xslTrans);
transformer.setOutputProperty(OutputKeys.ENCODING, "latin1");
transformer.setOutputProperty(OutputKeys.CDATA_SEC TION_ELEMENTS,"options");
transformer.transform(input, output)

where input and output are Documents. this works pretty well on most
pages except a few gives it problems. for example,
http://www.netsol.com does not work. i get the following error:

-------------------------------------------------------------------
javax.xml.transform.TransformerException: org.w3c.dom.DOMException:
NAMESPACE_ERR: An attempt is made to create or change an object in a way
which is incorrect with regard to namespaces.
at
org.apache.xalan.transformer.ClonerToResultTree.cl oneToResultTree(ClonerToResultTree.java:26
at
org.apache.xalan.templates.ElemCopy.execute(ElemCo py.java:155)
at
org.apache.xalan.templates.ElemApplyTemplates.tran sformSelectedNodes(ElemApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.exec ute(ElemApplyTemplates.java:216)
at
org.apache.xalan.transformer.TransformerImpl.execu teChildTemplates(TransformerImpl.java:2339)
at
org.apache.xalan.templates.ElemCopy.execute(ElemCo py.java:162)
at
org.apache.xalan.templates.ElemApplyTemplates.tran sformSelectedNodes(ElemApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.exec ute(ElemApplyTemplates.java:216)
at
org.apache.xalan.transformer.TransformerImpl.execu teChildTemplates(TransformerImpl.java:2339)
at
org.apache.xalan.transformer.TransformerImpl.apply TemplateToNode(TransformerImpl.java:2160)
at
org.apache.xalan.transformer.TransformerImpl.trans formNode(TransformerImpl.java:1213)
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:66
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1129)
at
org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1107)
at ApplyTextSpan.applyXSL(ApplyTextSpan.java:79)
at ApplyTextSpan.main(ApplyTextSpan.java:40)
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made
to create or change an object in a way which is incorrect with regard to
namespaces.
at
org.apache.xalan.transformer.ResultTreeHandler.flu shElem(ResultTreeHandler.java:870)
at
org.apache.xalan.transformer.ResultTreeHandler.flu shPending(ResultTreeHandler.java:954)
at
org.apache.xalan.transformer.ResultTreeHandler.sta rtElement(ResultTreeHandler.java:243)
at
org.apache.xalan.transformer.ClonerToResultTree.cl oneToResultTree(ClonerToResultTree.java:219)
... 15 more
---------

i'm also using xerces 2.6.2 along with neko 0.9.4. can someone perhaps
shed some light on this error? thank you very much.

--
Xiaolei Li | http://www.velocityreviews.com/forums/(E-Mail Removed) | www.xiaolei.org
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
blocking I/O with javax.xml.parsers.DocumentBuilder.parse() and javax.xml.transform.Transformer.transform() jazzdman@gmail.com Java 1 03-27-2005 06:56 AM
XSL-1000: (Fatal Error) Error while parsing XSL file (org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy) Kevin Flood Java 1 09-13-2004 02:28 PM
XSL-1000: (Fatal Error) Error while parsing XSL file (org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy) Kevin Flood Java 0 09-08-2004 02:11 PM
What parses the xml/xsl transform in asp.net? System.xml NOT msxml? KathyB ASP .Net 0 06-25-2003 05:03 PM



Advertisments