Harry Zoroc
Usenet Archive
- Joined
- Jul 7, 2004
- Messages
- 6
- Reaction score
- 0
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why?
I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like:
java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt
Using Saxon yields no better result. The produced myout.html contains all HTML tags and a lot of tabulators but no filtered contents from the xsd file.
Both XSLT processor work for other xml/XSLT formattings. So it's not an error of the xslt procs setup.
So what's wrong with the xslt stylesheet?
Harry
myschema.xsd (beginning):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema targetNamespace="http://www.blah.org/aaa" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" elementFormDefault="qualified"> <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="ddd.xsd"/> <import namespace="http://www.foo.com/bbb" schemaLocation="bbb.xsd"/> <import namespace="http://www.zock.net/ccc" schemaLocation="ccc.xsd"/> .....
myxsltfile.xslt:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl
utput method="html"/> <xsl:template match="/"> <HTML> <HEAD> <TITLE>Test</TITLE> </HEAD> <BODY> targetNamspace=<xsl:apply-templates select="/schema"/>
Imports:
<TABLE border="1">
<TR><TH>Namespace</TH><TH>SchemaLocation</TH></TR>
<xsl:apply-templates select="/schema/import"/>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="/schema">
<xsl:value-of select="@targetNamespace"/>
</xsl:template>
<xsl:template match="/schema/import">
<TR>
<TD><xsl:value-of select="@namespace"/></TD>
<TD><xsl:value-of select="@schemaLocation"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>
I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like:
java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt
Using Saxon yields no better result. The produced myout.html contains all HTML tags and a lot of tabulators but no filtered contents from the xsd file.
Both XSLT processor work for other xml/XSLT formattings. So it's not an error of the xslt procs setup.
So what's wrong with the xslt stylesheet?
Harry
myschema.xsd (beginning):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema targetNamespace="http://www.blah.org/aaa" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" elementFormDefault="qualified"> <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="ddd.xsd"/> <import namespace="http://www.foo.com/bbb" schemaLocation="bbb.xsd"/> <import namespace="http://www.zock.net/ccc" schemaLocation="ccc.xsd"/> .....
myxsltfile.xslt:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl
Imports:
<TABLE border="1">
<TR><TH>Namespace</TH><TH>SchemaLocation</TH></TR>
<xsl:apply-templates select="/schema/import"/>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="/schema">
<xsl:value-of select="@targetNamespace"/>
</xsl:template>
<xsl:template match="/schema/import">
<TR>
<TD><xsl:value-of select="@namespace"/></TD>
<TD><xsl:value-of select="@schemaLocation"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>