W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Re: Formattings in XML Document!

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Fri, 15 Feb 2002 10:39:18 -0500
Message-Id: <>
To: "Schema_Mailinglist" <xmlschema-dev@w3.org>
At 2002-02-15 15:56 +0100, mogot@web.de wrote:
>But I want to ask, how can I HTML-elements without defining these in my 
>primary schema?

By making the kurztext element unconstrained (deriving it directly from 
ur-type).  I changed your use of complexType to just be an empty element.

As for the stylesheet, you have redundantly declared template rules for 
HTML when you could just copy them from the source XML if you trust they 
contents are valid HTML.  But then the problem is the namespace nodes of 
your source end up in your result HTML.  Note below how I wrote a template 
that copies elements to the result while stripping namespace nodes attached 
to the elements in the source.

I hope this helps.

.................... Ken

T:\ftemp>type mogot.xsd
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
         <xs:element name="kurztext"/>
         <xs:element name="root">
                                 <xs:element ref="kurztext" 

T:\ftemp>type mogot.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                         Dies ist ein Text mit
                         und hohen
                         Elementen E<sub>B</sub>.
                         Dies ist ein Text mit Objekt
                         und FlSche 12m
                         <sup>2</sup> und

T:\ftemp>type mogot.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 

<xsl:template match="root">
   <xsl:for-each select="kurztext">
       <xsl:text/>Kurztext <xsl:value-of select="position()"/>: <xsl:text/>
     <xsl:apply-templates mode="no-namespaces"/>

<xsl:template match="*" mode="no-namespaces">
   <xsl:element name="{name(.)}">
     <xsl:copy-of select="@*"/>
     <xsl:apply-templates mode="no-namespaces"/>


T:\ftemp>xt mogot.xml mogot.xsl
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<p>Kurztext 1: </p>
                         Dies ist ein Text mit
                         und hohen
                         Elementen E<sub>B</sub>.
         <p>Kurztext 2: </p>
                         Dies ist ein Text mit Objekt
                         und Fl&auml;che 12m
                         <sup>2</sup> und


Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002

G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                        Definitive XSLT & XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:         2002-02-18,21,27,03-04,05,06,11,15,
-              04-08,09,10,11,05-06,07,09,10,06-04,07,10,11,13,14
Received on Friday, 15 February 2002 10:39:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:59 UTC