XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
William BurrowsSubject: Using WYSIWYG and "choice" element
Author: William Burrows
Date: 07 Dec 2004 07:32 PM
Hi .. I have a schema segment as follows:

<xsd:element name="PriorSchoolInfo">
<xsd:complexType>
<xsd:choice>
<xsd:element name="Undergraduate" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="HighSchoolName" type="xsd:string"/>
<xsd:element name="HSGPA" type="xsd:decimal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Graduate" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CollegeName" type="xsd:string"/>
<xsd:element name="CollGPA" type="xsd:decimal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>

I then have an xml document with two Undergraduate elements:

<Student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://f:\MSIS501_2005_Tutorials\XML_Docs\tut02\Project\Student.xsd">
<Name>Sue</Name>
<Age>45</Age>
<Sex>Female</Sex>
<PriorSchoolInfo>
<Undergraduate>
<HighSchoolName>XXX High</HighSchoolName>
<HSGPA>3.56</HSGPA>
</Undergraduate>
<Undergraduate>
<HighSchoolName>ZZZ High</HighSchoolName>
<HSGPA>2.56</HSGPA>
</Undergraduate>
</PriorSchoolInfo>
</Student>

Since this xml document only has Undergraduate elements (Graduate elements would not be legal)
the WYSIWYG editor does not know about the Graduate element.

What I would like to do is generate HTML where either a table with
Undergraduate info or Graduate info depending on the xml content.

Can I somehow use the Schema instead of a sample xml file to generate
the stylesheet (still with WYSIWYG). If so, how. If not, what would you
suggest?

Thanks ... bill burrows

Posttop
Minollo I.Subject: Re: Using WYSIWYG and "choice" element
Author: Minollo I.
Date: 07 Dec 2004 08:34 PM

>...
>Can I somehow use the Schema instead of a sample xml file to generate
>the stylesheet (still with WYSIWYG). If so, how. If not, what would you
>suggest?

WYSIWYG provides a design "preview" of your XSLT; in order to properly
display possible choices, you need to provide one (or more) XML document as
input that contains such choices. Possible solutions to your problem are:
- running WYSIWYG using different XML documents to exercise different
parts of the XSLT
- creating an XML instance out of the XML schema representing the input
(not sure how that would work with your schema, but you can try using the
"XML Schema to XML" document wizard to do that)
- manually modifying the XML document you are currently using as input
adding a simulated entry of the element it's missing and that you know may
show up

Hope this helps,
Minollo

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.