[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Jeffrey Moss wrote:
Hi,
one thing to remember is that XHTML is lowercase. You could do something like this:
*and* catch any non-compliant elements and convert them to something like:
<div class="nonCompliantName"/>
You will also want to catch things like empty title, script and textareas and do something like:
<xsl:template match="title | script | textarea">
<xsl:choose>
<xsl:when test="not(boolean(text()))">
<xsl:element name="translate(local-name(), $upper_case, $lower_case)">
<xsl:apply-templates select="@*"/>
<!-- **** -->
<xsl:comment/>
<!-- **** -->
</xsl:element>
</xsl:when>
<xsl:otherwise>
do the same thing as the default template above
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Re: [xsl] XHTML to XHTML transform
Subject: Re: [xsl] XHTML to XHTML transform From: Robert Koberg <rob@xxxxxxxxxx> Date: Fri, 02 Apr 2004 10:53:32 -0800 |
Jeffrey Moss wrote:
I want to create XHTML files and run them through some transforms to turn things
Hi,
one thing to remember is that XHTML is lowercase. You could do something like this:
<xsl:variable name="upper_case" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:variable name="lower_case" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:template match="node()|@*"> <xsl:element name="translate(local-name(), $upper_case, $lower_case)"> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template>
*and* catch any non-compliant elements and convert them to something like:
<div class="nonCompliantName"/>
You will also want to catch things like empty title, script and textareas and do something like:
<xsl:template match="title | script | textarea">
<xsl:choose>
<xsl:when test="not(boolean(text()))">
<xsl:element name="translate(local-name(), $upper_case, $lower_case)">
<xsl:apply-templates select="@*"/>
<!-- **** -->
<xsl:comment/>
<!-- **** -->
</xsl:element>
</xsl:when>
<xsl:otherwise>
do the same thing as the default template above
</xsl:otherwise>
</xsl:choose>
</xsl:template>
best, -Rob
-Jeff
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XHTML to XHTML transform, Wendell Piez | Thread | Re: [xsl] XHTML to XHTML transform, Robert Koberg |
RE: [xsl] XHTML to XHTML transform, Andreas L. Delmelle | Date | Re: [xsl] XHTML to XHTML transform, Jeffrey Moss |
Month |
Keywords