Subject: Re: [xsl] xsl:value-of select : how to make some tags printed and others not From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 07 Oct 2003 11:54:55 -0400 |
Hi Judith, Taking hint from David Carlisle's answer, I have written this XSL --
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/"> <xsl:apply-templates select="//text" /> </xsl:template>
<xsl:template match="//text"> <xsl:copy> <xsl:apply-templates select="node()" /> </xsl:copy> </xsl:template>
<xsl:template match="text"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="sw"> <xsl:value-of select="." /> </xsl:template>
<xsl:template match="sub"> <sub> <xsl:value-of select="." /> </sub> </xsl:template>
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
<xsl:template match="sw"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="attribute::*|child::node()" priority="-0.5"> <!-- known in XSLT-speak as the "identity template" since it creates a node-for-node copy of the input tree --> <xsl:copy> <xsl:apply-templates select="attribute::*|child::node("/> </xsl:copy> </xsl:template>
<xsl:template match="sw" priority="0"> <xsl:apply-templates select="child::node()"/> </xsl:template>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:value-of select : how, Mukul Gandhi | Thread | [xsl] [Q] for-each formatting probl, hgadm |
Re: [xsl] xsl:value-of select : how, David Carlisle | Date | Re: [xsl] performing 2 conversions , Wendell Piez |
Month |