Subject: Re: [xsl] lowercasing all attributes... From: Steve Ball <Steve.Ball@xxxxxxxxx> Date: Tue, 29 Jan 2002 12:13:55 +1100 |
I'd like to lowercase a document's attributes through <xsl:apply-templates select="???">
Do you mean that you'd like to select nodes based on their attribute names or values, but in a case-insensitive manner?
I know it's translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') but how 'bout the template match pattern and the select for apply-templates ??
Unfortunately, XSLT v1.0 doesn't provide a way of defining a function in the stylesheet so we have to do things the hard way. If I'm looking for the attribute named 'foo', but in any permutation of case ('Foo', 'FOO', etc), try this(*):
<xsl:template match='*'> <xsl:for-each select='@*'> <xsl:variable name='lower'> <xsl:call-template name='str:to-lower'> <xsl:with-param name='text' select='.'/> </xsl:call-template> </xsl:variable>
<xsl:if test='$lower = "foo"'> <!-- This is the one I want --> </xsl:if> </xsl:for-each> </xsl:template>
<xsl:template match='*/@*[translate(., "ABC...", "abc...") = "foo"]'> <!-- This is the one I want --> </xsl:template>
* You must setup XSLTSL to work in your stylesheet. See http://xsltsl.sf.net/ for instructions on how to do that.
HTHs, Steve Ball
-- Steve Ball | XSLT Standard Library | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development Steve.Ball@xxxxxxxxx +---------------------------+--------------------- Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] lowercasing all attribute, ronald heller | Thread | [xsl] Hi Dimitre, question on extra, Ahmad J Reeves |
Re: [xsl] Call perl script within x, Steve Ball | Date | RE: [xsl] Simple attribute value re, Edward . Middleton |
Month |