[xsl] Default rule for passing matched elements thru unchanged?

Subject: [xsl] Default rule for passing matched elements thru unchanged?
From: Brad Cox <bcox@xxxxxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2002 23:56:14 -0500
I'm baffled by how to build an xslt stylesheet that recognizes specified elements while passing those not specified through unchanged. The application intends to add programming capabilities to ordinary xhtml documents; e.g. show, if, foreach, etc, where these might appear anywhere, such as within xhtml elements. I'd rather not enumerate every imaginable xhtml element name; I don't have the complete list.

My best shot so far doesn't do it; it deletes everything but show elements.

<xsl:template match="show" priority="1">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="*"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="normalize-space(text())"/></xsl:template>

And of course, copy-of won't work because it copies (and ignores) the language rules (like show).

No doubt, the match="*" rule needs to generate the current node explicitly before calling apply-templates. But I don't see how to regenerate a node with its attributes.

Could someone pleae advise? Thanks!

--
Brad Cox, PhD; bcox@xxxxxxxxxxxxxxxxx 703 361 4751
o For industrial age goods there were checks and credit cards.
   For everything else there is http://virtualschool.edu/mybank
o Java Interactive Learning Environment http://virtualschool.edu/jile
o Java Web Application Architecture: http://virtualschool.edu/jwaa



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread