[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT test of xsl variable problem
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|