[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Schema Exploration...
Ok, yes, I took this approach and defined a key like yours only with the match selection I got from Wendell. <xsl:key name="elements-by-parent-element" match="xs:schema/xs:element | xs:element/xs:element | xs:element/xs:complexType/xs:choice/xs:element | xs:element/xs:complexType/xs:sequence/xs:element | xs:element/xs:complexType/xs:element" use="concat(ancestor::xs:element[1]/@name, '//', (@name | @ref))"/> Yes, I'd like to come up with a simpler match pattern that gets all the possiblities for xs:elements. Plus, I want to do some similar keys for attributes-by-parent-element. So Far the closest I've been able to come is: <xsl:variable name="my_snode" select="($parent_snode/descendant::xs:element)[@name=$node_name or @ref=$node_name]"/> Unfortunately, I don't think this will exclude cases where the "child" xs:element (its not really a child, I know) isn't really a "1st" descendant. 1st descendant meaning, there are no xs:elements between it and the "parent" xs:element (its not really a parent, I know). So I was try something like this, but I can't get the syntax right: <xsl:variable name="my_snode" select="($parent_snode/descendant::xs:element/*[ancestor::xs:element[@name=$parent_snode/@name]][1] )[@name=$node_name or @ref=$node_name]"/> I have a good example going now with this approach. It works very well for the schema I've been working with. Here's a demo site (Don't expect it will stay there forever.) http://vdc.fas.harvard.edu:8080/Editor/index.htm (Look under Project 2) Its a little slow due to some server side buffering I need to resolve, but it works. The XSL and schema are provided as well. -Mark gulp XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|