xsl-list
[Top] [All Lists]

Re: [xsl] For this input element, fire all matching template rules. Any way to fire multiple template rules for an input element?

2010-04-19 07:19:55
Roger,

One way to handle this (and I guess there will be some far more elegant 
solutions presented) would be to assign each rule a different priority 
(according to the order of reports you want to have, maybe) and then within 
each rule at the end insert

<xsl:next-match />

I just recently discovered this xsl element, which I used never before.

- Michael

Am 19.04.2010 um 14:12 schrieb Costello, Roger L.:

Hi Folks,

I have an XSLT program that analyzes XML Schema documents.

My XSLT creates a report if an element that uses the maxLength facet. It 
creates a (separate) report if the element uses the minLength facet. In fact, 
it creates a separate report for each facet used.

Consider this element declaration:

   <element name="Author">
       <simpleType>
           <restriction base="string">
               <minLength value="1" />
               <maxLength value="256" />
           </restriction>
       </simpleType>
   </element>

What I really want is to create a template rule for each report:

   <xsl:template 
match="xs:element[xs:simpleType/xs:restriction/xs:minLength]">
       <!-- report on the use of the minLength facet -->
   </xsl:template>

   <xsl:template 
match="xs:element[xs:simpleType/xs:restriction/xs:maxLength]">
       <!-- report on the use of the maxLength facet -->
   </xsl:template>

   <xsl:template 
match="xs:element[xs:simpleType/xs:restriction/xs:enumeration]">
       <!-- report on the use of the enumeration facet -->
   </xsl:template>

   <xsl:template match="xs:element[xs:simpleType/xs:restriction/xs:pattern]">
       <!-- report on the use of the pattern facet -->
   </xsl:template>

   Etc.

And have all applicable rules fire. For the above example, the first two 
rules should fire.

Unfortunately this doesn't work. I get an error saying the XSLT program is 
ambiguous because multiple rules are applicable.

Is there any way to create an XSLT program and specify, "For this input 
element, fire all matching template rules."

/Roger 

--
_______________________________________________________________
Michael Müller-Hillebrand: Dokumentations-Technologie
Adobe Certified Expert, FrameMaker
Lösungen und Training, FrameScript, XML/XSL, Unicode
Blog: http://cap-studio.de/ - Tel. +49 (9131) 28747






--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--