[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT test of xsl variable problem

Subject: XSLT test of xsl variable problem
From: Ann Marie Rubin <Annmarie.Rubin@xxxxxxx>
Date: Wed, 03 Nov 2004 10:09:35 -0500
xsl if test variable
Hi David,

Thanks for you response.  I'm trying a new approach but having trouble
constructing a test for the value of an xsl variable.

The var definition:

<xsl:variable name="testvar" select="'deployment-version'"/>

The if that tests whether or not the value of testvar matches the string
"deployment-version":

<xsl:if test="deployment-version=$testvar">

The test doesn't pass so nothing is output in the result tree.

Is this the correct way to compare the value of a string to the value of
an xsl variable?

Thanks,

Ann Marie


Here is the Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes" method="xml"/>
    <xsl:variable name="testvar" select="'deployment-version'"/>
    <xsl:template match="*|@*|text()|comment()">
        <xsl:copy>
            <xsl:apply-templates select="*|@*|text()|comment()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template name="copy-content-no-attrs">
        <xsl:apply-templates
select="processing-instruction()|comment()|*|text()"/>
    </xsl:template>
    <xsl:template match="orion-web-app[@deployment-version]">
    <xsl:if test="deployment-version=$testvar">
   
   
               <xsl:copy>
            <xsl:attribute
name="deployment-version">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='deployment-version')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
        </xsl:copy>
        </xsl:if>
        </xsl:template>
           
    <xsl:template match="orion-web-app[@temporary-directory]">
          <xsl:if test="temporary-directory=$testvar">
            <xsl:copy>
            <xsl:attribute
name="temporary-directory">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='temporary-directory')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
        </xsl:copy>
        </xsl:if>
    </xsl:template>
    <xsl:template match="orion-web-app[@internationalize-resources]">
              <xsl:if test="internationalize-resources">
            <xsl:copy>
            <xsl:attribute
name="internationalize-resources">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='internationalize-resources')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
        </xsl:copy>
  </xsl:if>
    </xsl:template>
    <xsl:template match="orion-web-app[@default-mime-type]">
         <xsl:if test="default-mime-type">
            <xsl:copy>
            <xsl:attribute name="default-mime-type">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='default-mime-type')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
        </xsl:copy>
   </xsl:if>
    </xsl:template>
        <xsl:template
match="web-app-class-loader[@search-local-classes-first]">
     <xsl:if test="search-local-classes-first">
        <xsl:copy>
            <xsl:attribute
name="search-local-classes-first">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='search-local-classes-first')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
            </xsl:copy>
  </xsl:if>
        </xsl:template> 
        <xsl:template
match="web-app-class-loader[@include-war-manifest-class-path]">
          <xsl:if test="include-war-manifest-class-path">
        <xsl:copy>
            <xsl:attribute
name="include-war-manifest-class-path">:[value]</xsl:attribute>
            <xsl:apply-templates
select="@*[not(name()='include-war-manifest-class-path')]"/>
            <xsl:call-template name="copy-content-no-attrs"/>
            </xsl:copy>
   </xsl:if>  
        </xsl:template>      
 
</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.