At 16:57 05-05-2004, Andrew Welch wrote:
> After a while of hacking java solutions, that could be done
> using xslt I'll
> try making a second attempt in using xsl. I have some
> fundamental problems
> getting started:
>
> I want to transform an xhtml file input and transform it into
> something
> else, but I get an error with a non defined entity.
>
> The document may contain mathml, danish letters æøå and other
> odd things.
> These things should just go straight through the
> transformation without any
> transformation, but the engine keeps arguing that it must be
> defined....
>
> Can it be avoided that the transformation engine worries
> about definitions
> of entities?
> If not: how can I easily import these definitions?
>
> The input xhtml is strict and can be viewed in mozilla, so
> there are no
> problems there.
If you are talking about entity resolution then the xml parser must
attempt to resolve the entity to ensure the xml is well-formed.
You can turn off validation, but the parser will still attempt to get the
dtd for this purpose.
To get around this, you can try implementing your own entity resolver in
java, and just return the entity reference (instead of what it resolves
to) or if you are using xerces you can set the feature
http://apache.org/xml/features/nonvalidating/load-external-dtd to false
which I think will ignore the dtd altogether.
In your case, are you talking entities or character references? I'm
guessing you're using xhtml entities that are not legal in xml - if you
could post a sample that fails then it would be a little clearer.
Here's the full case:
I would like to take an xhtml file and use xslt to transform it to
something where I wrap special parts in links:
So the input could be something like:
-----------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [<!ENTITY mathml
"http://www.w3.org/1998/Math/MathML">]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test-1</title>
</head>
<body>
<h1>Forside</h1>
bla bla
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<msqrt>
<mrow>
<mi>α</mi>
</mrow>
</msqrt>
</mrow>
</math>
</body>
</html>
------------------------------------------------------------
And the output something like:
------------------------------------------------------------
<part id="1" type="heading" size="1">Forside</part>
<part id="2" type="math" size="2"><math
xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<msqrt>
<mrow>
<mi>α</mi>
</mrow>
</msqrt>
</mrow>
</math></part>
------------------------------------------------------------
I'm developing the xslt using xsllerator (MSXML4) while in my program I'm
using JDOM's default transformer. This can be easily changed, but I don't
know what transformer that's the best to choose.
If you can guide me in the right direction I'll try that.
Regards
Morten Andersen
cheers
andrew
--+------------------------------------------------------------------
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>
--+--