go4java
asked on
XSL/XML/XHTML: Include XML content and write to XHTML
Hi Gertone,
we have the following XSL scriptlet:
<xsl:variable name="webDescription" select="/Root/Object/Exter nalReferen ces/Keywor d[Characte ristic='ZP DB_WEBDESC RIPTION']/ Value"/>
<xsl:variable name="webDescriptionParsed " select="translate($webDesc ription, '\', '/')"/>
<xsl:copy-of select="document($webDescr iptionPars ed)"/>
Basically, it will read an XML file from the file server and should include the HTML content to the XHTML output stream.
The XHTML from XSL engine is as follows:
...
<html>
<p>bla bla</p>
</html>
...
The XHTML 1.0 Strict validator has a problem with html/xmlns missiong and <P> not allowed.
Is there a trick how the XML header should look like so that HTML will be displayed and validated or should the XML file be addressed with XPath - but how to apply the format tags then?!
Ciao
we have the following XSL scriptlet:
<xsl:variable name="webDescription" select="/Root/Object/Exter
<xsl:variable name="webDescriptionParsed
<xsl:copy-of select="document($webDescr
Basically, it will read an XML file from the file server and should include the HTML content to the XHTML output stream.
The XHTML from XSL engine is as follows:
...
<html>
<p>bla bla</p>
</html>
...
The XHTML 1.0 Strict validator has a problem with html/xmlns missiong and <P> not allowed.
Is there a trick how the XML header should look like so that HTML will be displayed and validated or should the XML file be addressed with XPath - but how to apply the format tags then?!
Ciao
ASKER
The XML now looks like that:
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<p>...</p>
</body>
</html>
The HTML output is:
<html>
<body>
<p>...</p>
</body>
</html>
...and if I run the XSL as mentioned above, the XHTML strict 1.0 returnes the following errors:
- xmlns missing
- html not allowed
- body not allowed
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<p>...</p>
</body>
</html>
The HTML output is:
<html>
<body>
<p>...</p>
</body>
</html>
...and if I run the XSL as mentioned above, the XHTML strict 1.0 returnes the following errors:
- xmlns missing
- html not allowed
- body not allowed
go4java,
> <xsl:copy-of select="document($webDescr iptionPars ed)"/>
just a quick guess
did you try this?
<xsl:copy-of select="document($webDescr iptionPars ed)//html" />
it might help you keep the namespace declaration
> <xsl:copy-of select="document($webDescr
just a quick guess
did you try this?
<xsl:copy-of select="document($webDescr
it might help you keep the namespace declaration
ASKER
unfortunately not...
ASKER
I've removed <html> and <body> from the input XML and inserted only a <div>-tag as root.
The result by the XHTML strict validator is as follows:
<div xmlns="">
xmlns is not allowed!
xmlns has automatically been inserted?!
Ciao
The result by the XHTML strict validator is as follows:
<div xmlns="">
xmlns is not allowed!
xmlns has automatically been inserted?!
Ciao
ASKER
Hi Gertone,
we're able to manage like that:
<?xml version="1.0" encoding="ISO-8859-1"?>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>...</p>
</div>
we're able to manage like that:
<?xml version="1.0" encoding="ISO-8859-1"?>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>...</p>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
likely you can just put the namespace declaration in your snippet already
like this
<html xmlns="http://www.w3.org/1999/xhtml"
in xhtml strict <p> cannot be a child of <html>
you need at least a body tag
change your snippert to this and try again
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<p>bla bla</p>
</body>
</html>
Cheers!