Re: [xsl] create XSLT from XML or XSD

Subject: Re: [xsl] create XSLT from XML or XSD
From: "Jacek Radajewski" <jacekrad@xxxxxxxxx>
Date: Mon, 28 Jul 2008 08:09:25 +1000
Hi Henry,

This is a very basic implementation which simply creates a XSLT stub
template for each element declared in your schema (XSD).  It does not
cater for elements with the same name in different scope, but can be
easily modified to do so.

Run the stylesheet below against your XSD and the result will be an
XSLT stylesheet with empty templates generated for each element.  Hope
this is what you were looking for.

Cheers

Jacek

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema";
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output indent="yes" method="xml"/>

  <xsl:template match="/">
    <xsl:element name="xsl:stylesheet">
      <xsl:namespace name="xsl"
select="'http://www.w3.org/1999/XSL/Transform'"/>
      <xsl:attribute name="version" select="'2.0'"/>
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="xs:element[@name]">
    <xsl:text>&#xA;&#xA;</xsl:text>
    <xsl:element name="xsl:template">
      <xsl:attribute name="match" select="@name"/>
      <xsl:text>&#xA;</xsl:text>
      <xsl:comment> auto generated stub for element <xsl:value-of
select="@name"/>
      </xsl:comment>
      <xsl:text>&#xA;</xsl:text>
    </xsl:element>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="text()"/>

</xsl:stylesheet>


> On Sun, Jul 27, 2008 at 12:53 AM, henry human <henry_human@xxxxxxxx> wrote:
>>
>> Hi
>> I have some very large XSD files. It is a little sore
>> to build the according XSL files for them I thougth to
>> generate the XML files for them with the tool and
>> create the XSL files from the XMLs. Is there any tool
>> which do that??
>> thanks
>> henry
>>
>>
>>      __________________________________________________________
>> Gesendet von Yahoo! Mail.
>> Dem pfiffigeren Posteingang.
>> http://de.overview.mail.yahoo.com
>>
>
>
>
> --
> Jacek Radajewski



--
Jacek Radajewski

Current Thread