This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[ ? ] Ignoring redundancy


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]