[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

how to use an xsd as an xml, or is it an include-probl

Subject: how to use an xsd as an xml, or is it an include-problem?
From: Rene de Vries <RdVries@xxxxxxxxxxx>
Date: Tue, 24 Apr 2001 10:51:01 +0200
how to use xsd
Hi xsl-ers,

I'm new in xml/xsl/xsd/x..-land, and so I hope that my question is an 
easy-one for you. I'm just in the stadium monkey see, monkey do.....

I'm trying to display an xsd in a readable way for end-users. The xml they 
have to create is database-like, so I want to show a html-table with the 
database layout: the "fields" for each "datafile". First I want to add a 
description to the fields, later more compex things like types, required 
etc.
I don't want to change the xsd, so I made a separate description-xml and a 
main-xml, including the xsd (as an xml) and the description xml:

main-xml (including everything I need):
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">
  <xinclude:include href="AX_VB.xsd"/>
  <xinclude:include href="Descriptions_VB.xml"/>
</document>

a part of my xsd (which I want to display):
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:include schemaLocation="Datatypes.xsd"/>
  <xsd:element name="OfferteAanvraag" type="OfferteAanvraagType"/>
  <xsd:complexType name="OfferteAanvraagType">
    <xsd:sequence>
      <xsd:element name="Header" type="HeaderType"/>
      ........
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="HeaderType">
    <xsd:sequence>
      <xsd:element name="VerzenderNrHDN" type="HdnNrType"/>
      <xsd:element name="VerzenderNaam" type="string35Type"/>
      ........
    </xsd:sequence>
  </xsd:complexType>
  ......
</xsd:schema>


a part of my description-xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Descriptions>
  <HeaderType>
    <DescriptionShort>"Standaard header bericht"</DescriptionShort>
    <DescriptionLong>"Standaard header"</DescriptionLong>
    <VerzenderNrHDN>
      <DescriptionShort>"Verzendernummer"</DescriptionShort>
      <DescriptionLong>"Unieke HDN-nummer verzender"</DescriptionLong>
    </VerzenderNrHDN>
    <VerzenderNaam>
      <DescriptionShort>"Verzendernaam"</DescriptionShort>
      <DescriptionLong>"Achternaam met voorvoegsel of maatschappijnaam van 
verzender"</DescriptionLong>
    </VerzenderNaam>
    .......
  </HeaderType>
  .......
</Descriptions>

my xsl (which doesn't work at all):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" 
xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">
  <xsl:output method="html"/>
  <xsl:strip-space elements="*"/>
<!--  -->
<!-- / -->
  <xsl:template match="/">
     <html>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>
<!--  -->
<!-- xsd:element -->
  <xsl:template match="xsd:element">
    <xsl:choose>
    <xsl:when test="..=/">
       <b>
         Schema: <xsl:value-of select="@name"/>
      </b>
    </xsl:when>
    <xsl:otherwise>
  	  <tr>
	      <td width="10%">
       	 <xsl:value-of select="@name"/>
	      </td>
	      <!-- here I want to pull in the Description from the 
Descriptions.xml -->
 	      <xsl:variable name="parent" select="../@name"/>
	      <xsl:variable name="naam" select="@name"/>
	      <xsl:variable name="xxx" 
select="document(xsd:schema/xinclude:include/@href)"/>
	      <td><xsl:value-of 
select="$xxx//Descriptions/@parent/@naam/DescriptionShort"/></td>
	      <td width="10%">
	        <xsl:value-of select="@type"/>
	      </td>
	   </tr>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
<!--  -->
<!-- xsd:complexType -->
  <xsl:template match="xsd:complexType">
    <xsl:if test="..=/">
      <hr/>
          <b>
            <xsl:value-of select="@name"/>
          </b>
    </xsl:if>
      <xsl:attribute name="id"><xsl:value-of 
select="@name"/></xsl:attribute>
          <xsl:apply-templates select="*"/>
  </xsl:template>
<!--  -->
<!-- xsd:sequence -->
  <xsl:template match="xsd:sequence">
    <xsl:if test="..=/">
      <hr/>
    </xsl:if>
    <table border="1" width="100%">
      <tr>
        <td>
          <xsl:apply-templates select="*"/>
        </td>
      </tr>
    </table>
  </xsl:template>
<!--  -->
</xsl:stylesheet>

The only thing I get is a bank page!

What do I do wrong????

Greetings Rene
   { @   @ }
        ^
      \__/

"You don't need eyes to see, you need vision!"



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.