ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] Simulate schema-awareness to create comboBoxes
by Michael Kay other posts by this author
Nov 28 2006 10:12AM messages near this date
RE: [xsl] Simulate schema-awareness to create comboBoxes | [xsl] Recursively looping through a template only X number of times?
& XSLT Neither the XSLT 2.0 spec, nor Saxon, currently offers you the ability to
introspect the schema in the way you want. I think that what you actually
need is some kind of access to the finite state machine produced by
compiling the schema. It might be possible to achieve this with suitable
extension functions, but it's not going to be easy. The information is
there, but not in very accessible form.

Michael Kay
http://www.saxonica.com/ 

>  -----Original Message-----
>  From: Angela Williams [mailto:Angela.Williams@[...].com] 
>  Sent: 28 November 2006 18:01
>  To: xsl-list@[...].com
>  Subject: [xsl] Simulate schema-awareness to create comboBoxes
>  
>  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 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 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.  
>  
>  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>
>  --~--
>  


--~------------------------------------------------------------------
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved