[xsl] looping through a lookup table

Subject: [xsl] looping through a lookup table
From: Ann Marie Rubin <Annmarie.Rubin@xxxxxxx>
Date: Mon, 15 Nov 2004 10:59:33 -0500
Hello List,

This stylesheet uses a static lookup table to define element attributes
that need to be updated.  search-local-classes-first="ORANGES" and
include-war-manifest-class-path="APPLES" out output as attributes of the
orion-web-app element AND the web-app-classloader element. They are
attributes of the web-app-class-loader element and should only be output
in the result tree for that element.

How do I get this to work?

thanks,

Ann Marie


<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:lookup="my:lookup"
  exclude-result-prefixes="lookup">
 
  <lookup:element>
     <orion-web-app temporary-directory="/var/temp"
                    deployment-version="10.0"
                    ROSE="RED"/>
     <web-app-class-loader search-local-classes-first="ORANGES"
                           include-war-manifest-class-path="APPLES"/>
   </lookup:element>

   <xsl:template match="node()">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
 
  <xsl:template match="@*">
 <xsl:copy-of select="."/>
   
  <xsl:choose>
   <xsl:when test="'orion-web-app'=name(parent::*)">  
   <xsl:copy-of select="document('')/*/lookup:element/orion-web-app/@*
                                  [name() = name(current())]"/>
 </xsl:when>
 </xsl:choose>
 
 <xsl:choose>
  <xsl:when test="'web-app-class-loader'=name(parent::*)">  
 <xsl:copy-of
select="document('')/*/lookup:element/orion-web-app/web-app-class-loader/@*
                                  [name() = name(current())]"/>
 </xsl:when>
 </xsl:choose>
   
                                   
  <xsl:choose>
       <xsl:when test="not(//@*=ROSE) and 'orion-web-app'=name(parent::*)">
             <xsl:copy-of select="document('')/*/lookup:element/*/@*"/>  
       </xsl:when>
  </xsl:choose>

   
      </xsl:template>
</xsl:stylesheet>

Current Thread