Subject: Re: [xsl] Schema Exploration... From: Mark Diggory <mdiggory@xxxxxxxxxxxxxxxxx> Date: Thu, 18 Apr 2002 18:37:46 -0400 |
Mark,
At 02:07 PM 4/18/2002, you wrote:
I'm trying to select a schema element node relative to the current xs:element node I've referenced in a parameter ($schema_node). The problem is that there are several cases that need to be checked for:
xs:element/*[@name='test1a' or @ref='test1b'] xs:element/xs:complexType/xs:choice/*[@name='test2a' or @ref='test2b'] xs:element/xs:complexType/xs:sequence/*[@name='test3a' or @ref='test3b']
You can take advantage of the fact that your schema should not have xs:elements with *both* a @name and a @ref to do something like:
<xsl:variable name="okaynames" select="'test1a test1b test2a test2b test3a test3b'"/>
<!-- the variable is not strictly necessary but makes things easier -->
<xsl:apply-templates select=".//xs:element[contains($okaynames, (@name|@ref))]"/>
If I understand your problem correctly, this will work because:
.//xs:element selects all xs:element descendants of the current node (*really* strictly, all xs:element children of nodes on the descendant-or-self axis from the current node). If your element declarations go down more than one level, you may have to be more specific with this step, as in select="(xs:element | xsl:complexType/xs:choice/xs:element | xs:complexType/xs:sequence/xs:element)[ ... the predicate ... ]"
-Thanks (You just reduced the size of my xslt document by about 75%) Mark HMDC
I hope that helps-- Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Schema Exploration..., Wendell Piez | Thread | Re: [xsl] Schema Exploration..., Jeni Tennison |
Re: [xsl] Selecting/matching based , Wendell Piez | Date | RE: [xsl] Evaluating a node-set wit, Dyck, Stan |
Month |