Thank you for your answers.
The problem was that it didnt match any template in my xsl. And true i didn't
know how these namespaces scrumble up my things. Earlier i didnt use namspaces.
But now i have read some words about it. And Mukul your solution was right.
Now everything works as it should.
Thank you again.
Sincerely, Lajos
--- On Mon, 12/21/09, Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
wrote:
From: Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
Subject: Re: [xsl] convert xml with schema to html with xslt
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Monday, December 21, 2009, 11:39 AM
It looks like, that your XML document
is in a namespace (defined by,
xmlns="urn:Verlag").
But your stylesheet doesn't consider namespaces.
for example, this template:
<xsl:template name="paragraph" match="para">
will not match the "para" node from XML, as "para" node in
your XML is
in a namespace (which is, "urn:Verlag").
Importing the schema in the stylesheet won't solve this
problem,
because schema import in XSLT 2.0 is for a different need
(basically
to provide the schema types and declarations to the
stylesheet).
I think, something like below may solve this problem:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="urn:Verlag" version="2.0">
<xsl:template name="paragraph"
match="ns1:para">
...
</xsl:stylesheet>
On Mon, Dec 21, 2009 at 3:51 PM, Lajos Joo <lajosjoo(_at_)yahoo(_dot_)com>
wrote:
Hello!
I have a problem. I have a small xml file which has a
schema declaration in the root element. I cannot convert it
to html with an xslt file. If i remove the schema
declaration the conversion is fine.
Please suggest me how to correct this.
I have included a shcema import but it didnt help:
<xsl:import-schema namespace="urn:Verlag"
schema-location="urn:Verlag http://192.168.190.181:8879/xml/STRUKTUR.xsd" />
The xml file looks like this:
<LOSCHNIGG xmlns="urn:Verlag"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:Verlag http://192.168.190.181:8879/xml/STRUKTUR.xsd">
<metadaten>
<gilt-ab>1000-01-01</gilt-ab>
<gilt-bis>9999-12-31</gilt-bis>
<Fassung_Publikation>
<Publikationsstand>2009-12-19</Publikationsstand>
<Release_Version>1</Release_Version>
</Fassung_Publikation>
</metadaten>
<para>
text...
</para>
</LOSCHNIGG>
The xml works fine and the xsd is in the right place.
The xsl looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml" version="2.0">
<!-- <xsl:import-schema
namespace="urn:Verlag" schema-location="urn:Verlag
http://192.168.190.181:8879/xml/STRUKTUR.xsd"
/>-->
<xsl:output encoding="UTF-8"
indent="yes" method="html" version="1.0" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates
select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
name="paragraph" match="para">
<xsl:element
name="p">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="/">
<xsl:element
name="html">
<xsl:element
name="head">
<xsl:element
name="title">Preview</xsl:element>
</xsl:element>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Thank you!
Lajos
--
Regards,
Mukul Gandhi
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--