[xsl] Simulate schema-awareness to create comboBoxes
by Angela Williams other posts by this author
Nov 28 2006 10:01AM messages near this date
[xsl] invoking nodes from multiple XML files
|
RE: [xsl] Simulate schema-awareness to create comboBoxes
& XSLT 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 n
eed to come up with something before then...
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 choice
s.
I'm using W3C XML Schema, XSLT 2.0, XPath 2.0 and Saxon8. We have a license for SaxonSA, bu
t it either doesn't offer the type of functionality I need or I just didn't recognize it.
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="Item-A" minOccurs="0" maxOccurs="1" />
<xs:element ref="Item-B" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<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"/>
</xs:schema>
Instance 1 > Only option should be 'Item-B':
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Item-A/>
</root>
Instance 2 > Options should be 'Item-A' and 'Item-B':
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Item-B/>
</root>
If someone could point me in the right direction, I would greatly appreciate it!
Thanks!
Angela Williams
Channel Developer
The 401k Company
512-344-1547
Â
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@[...].com>
--~--
Thread:
Angela Williams
Michael Kay
Michael Kay
|