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

RE: Transforming cascading included schemas

Subject: RE: Transforming cascading included schemas
From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx
Date: Tue, 1 Oct 2002 12:16:31 +0100
transforming xml schemas include xslt
Hello Jean

> -----Original Message-----
> From: Jean Lemons [mailto:jkslagle@xxxxxxxxxxxxx]
> Sent: 01 October 2002 05:03
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Transforming cascading included schemas
> 
> 
>   I need to produce documentation in HTML for web services defined in 
> WSDL. The schema for these are in separate XSD files 
> associated with the 
> WSDL file using xsd:include or xsd import. I need to access the 
> information in the schema to document the format information 
> for the web 
> service messages.
> 
> My problem is that the includes/imports for the needed schema are not 
> all in the primary source document. There are includes/imports in the 
> schema documents as well. Example:

[...]

> <!-- Key: types -->
> <xsl:key name="msgType" match="//xsd:schema//*" use="@name"/>
> ...
> <!-- Handle Include -->
> <xsl:template match="//xsd:include">
> <xsl:apply-templates select="document(@schemaLocation)"/>
> <xsl:apply-templates/>
> </xsl:template>
> ...
> 
> My confusion is in how to grab the document names so I can access the 
> key information. (I'm also not 100% sure I am getting the 
> keys). 

[...]

	Is it completely necessary for you to know the document names to use
the key? As things stand the nested schemas will all be transformed as if
they had been flattened out into one continuous document, except as regards
the key, which will only work within the scope of the context document. It
depends what you're using the key for.

	You can get all the names of the includes, though:

 <!-- top-level variable -->
 <xsl:variable name="includes">
    <xsl:apply-templates mode="getNames"/>
  </xsl:variable>

  <xsl:template match="/">
    <xsl:value-of select="$includes"/>
  </xsl:template>

  <xsl:template match="xsd:include" mode="getNames">
    <xsl:value-of select="@s"/><xsl:text>||</xsl:text>
    <xsl:apply-templates select="document(@s)//xsd:include"
mode="getNames"/>
 </xsl:template>


Effectively you're doing a preliminary pass over the whole lot, which could
be inefficient.

hth,
Tom


 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.