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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.