[ ? ] Ignoring redundancy

Subject: [ ? ] Ignoring redundancy
From: Mikol Graves <mikol@xxxxxxxxxx>
Date: Fri, 13 Oct 2000 12:39:40 -0700
I am in the process of writing a style-sheet that handles "depends-on"
relationships between XML represented objects. The XML looks something
like:
     
     ...
     <my-variable name="greeting"><body>'Hey there, '</body></my-var>
     <my-variable name="who"><body>'J. User'</body></my-var>

     <my-subroutine name="annoy">
       <require>greeting</require>
       <require>who</require>
       <args>
         <arg name="g"/>
         <arg name="w"/>
       </args>
       <body><![CDATA[
         return (g ? g : greeting) + (w ? w : who) + '!';
       ]]></body>
     </my-subroutine>
     ...

The "depends-on" relationship is handled by an XSLT template like so:

     <xsl:template match="require">
       <xsl:variable name="r" select="."/>
       <xsl:apply-templates 
            select="/*/my-variable[@name=$r] | /*/my-subroutine[@name=$r]"/>
     </xsl:template>

A problem arises when two objects have one or more "depends-on"
relationships in common because the required object(s) will be included
twice. Is there a way to determine when a required object has already
been included?



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread