Subject: [xsl] problem matching templates. From: "Snyder, Christopher" <SnyderC@xxxxxxx> Date: Thu, 8 Mar 2001 11:31:16 -0500 |
I have a fairly small xslt file the primary purpose of which is to translate capitalized tags to small case tags. Now I want to perform some modifications on a few specific tags, and I'm having problems. I can address classes of nodes without a problem, but when I try to address a specific node, it doesn't work. This is the xslt I'm using. Can anyone point out to me why the last template never seems to be applied? Thank you, Chris <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <!-- Transform a document to itself, lowercasing all tag names. --> <!-- When you match any element, do this: --> <xsl:template match="*"> <!-- Create the same element with a lowercase name --> <xsl:element name="{translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')}" namespace="http://www.imsproject.org/metadata/"> <!-- Including any attributes it has and any child nodes --> <xsl:apply-templates select="COPYRIGHTOROTHERRESTRICTIONS|comment()|node()|@*"/> </xsl:element> </xsl:template> <!-- Match all attributes. --> <xsl:template match="@*"> <xsl:attribute name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')}"> <xsl:value-of select="current()"/> </xsl:attribute> <xsl:apply-templates select="comment()|node()|@*"/> </xsl:template> <!-- Match and carry over all comment nodes. --> <xsl:template match="comment()"> <xsl:comment> <xsl:value-of select="."/> </xsl:comment> </xsl:template> <!-- Check text() nodes --> <xsl:template match="text()"> <xsl:choose> <xsl:when test="contains(., 'VERSION 1.0')"> VERSION 1.1 </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- Convert tag name --> <xsl:template match="COPYRIGHTOROTHERRESTRICTIONS"> <xsl:element name="copyrightandotherrestrictions"> <xsl:apply-templates/> </xsl:element> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] about xsl:when, Michael Kay | Thread | Re: [xsl] problem matching template, David Carlisle |
RE: [xsl] XSL and Namespaces, Borca, Olivier | Date | [xsl] [XSL] Get time and data, KOBILY |
Month |