[xsl] Simulate schema-awareness to create comboBoxes

Subject: [xsl] Simulate schema-awareness to create comboBoxes
From: "Angela Williams" <Angela.Williams@xxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Nov 2006 12:00:54 -0600
Hello -

I need some advice, please.  I have a multi-step problem and am not sure the
best direction to take. I've tried a few different options, but surely someone
has already solved this more elegantly than what I am doing.... I am attending
<XML2006> and thought I could wait, but need to come up with something before

Step 1: I need the global elements in a schema to be represented as options in
comboBoxes on a JSF page.

Step 2: I need to compare the user choices (in the instance document) against
the schema to dynamically add or remove options from the comboBox according to
the schema cardinality.

I can write a stylesheet to parse the schema to provide the lists, but that
just gives me a superset and doesn't account for cardinality. And I would
still have to continue to compare the instance doc against the parsed schema
to update the comboBoxes as the user makes choices.

I'm using W3C XML Schema, XSLT 2.0, XPath 2.0 and Saxon8.  We have a license
for SaxonSA, but it either doesn't offer the type of functionality I need or I
just didn't recognize it.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <xs:element name="root">
        <xs:element ref="Item-A" minOccurs="0" maxOccurs="1" />
        <xs:element ref="Item-B" minOccurs="1" maxOccurs="unbounded" />

  <xs:element name="Item-A" type="a-type"/>
  <xs:element name="Item-B" type="b-type"/>

  <xs:complexType name="a-type"/>
  <xs:complexType name="b-type"/>


Instance 1 > Only option should be 'Item-B':
<?xml version="1.0" encoding="UTF-8"?>

Instance 2 > Options should be 'Item-A' and 'Item-B':
<?xml version="1.0" encoding="UTF-8"?>

If someone could point me in the right direction, I would greatly appreciate

Angela Williams
Channel Developer
The 401k Company

Current Thread