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

how to match elements in all depth

Subject: how to match elements in all depth
From: Mansour <mansour77@xxxxxxxxx>
Date: Mon, 24 Mar 2008 19:34:42 -0300
 how to match elements in all depth
For some reason, I find xslt and xpath techniques are easy to forget. I believe I have done this before but couldn't remember exactly how. Ok, I have an xml schema and trying to convert it to DDL (data definition language) as SQL text.
For example, I picked this schema doc from the net http://www.xml.com/lpt/a/691:


<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="author" type="xs:string" />
<xs:element name="character" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="friend-of"
type="xs:string" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="since" type="xs:date" />
<xs:element name="qualification"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>


And All I am trying to do for now, is to create two tables, like this:
=========================================
CREATE TABLE book
               ( )

CREATE TABLE character
               ( )
=========================================

I have this template:
<xsl:template match="xs:element/xs:complexType/xs:sequence">
CREATE TABLE
<xsl:value-of select="../../@name" />
( )
<xsl:apply-templates />
</xsl:template>
It's doing what I want, but it's using recursive calls to apply to inner complex elements. How can I do this without recursion? In other words how to match elements in all depth?


Thank you.

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.