J
Josh Martin
comp.text.xml -
I've developed a simple XSLT program that generates a sample XML file
from a schema (note, it won't work in every instance, but works for
this program). My problem: how do I tell if an element encountered in
the schema is recursive? Without knowing this, the sample XML is
generated indefinitely. Here is a simple example:
<schema>
<complexType name="Package">
<element name="PackageID" type="string"/>
<element name="Quantity" type="integer"/>
<element ref="Package" minOccurs="0" maxOccurs="unbounded" />
</complexType>
<element name="Package" type="Package"/>
</schema>
My program simply prints elements and their children recursively. If
an @type or @ref is found, it finds the corresponding simpleType or
complexType and continues from there. In the example above, the
Package element (complexType) would continue to print infinitely. Is
there a way, using XSLT, to determine if an element is recursive, and
thus avoid "re-printing" it?
Thanks,
Josh
I've developed a simple XSLT program that generates a sample XML file
from a schema (note, it won't work in every instance, but works for
this program). My problem: how do I tell if an element encountered in
the schema is recursive? Without knowing this, the sample XML is
generated indefinitely. Here is a simple example:
<schema>
<complexType name="Package">
<element name="PackageID" type="string"/>
<element name="Quantity" type="integer"/>
<element ref="Package" minOccurs="0" maxOccurs="unbounded" />
</complexType>
<element name="Package" type="Package"/>
</schema>
My program simply prints elements and their children recursively. If
an @type or @ref is found, it finds the corresponding simpleType or
complexType and continues from there. In the example above, the
Package element (complexType) would continue to print infinitely. Is
there a way, using XSLT, to determine if an element is recursive, and
thus avoid "re-printing" it?
Thanks,
Josh