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

Re: XHTML to XHTML transform

Subject: Re: XHTML to XHTML transform
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 02 Apr 2004 10:53:32 -0800
xsl create xhtml
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

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.