[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] replacing nodes during xsl:copy-of
Subject: Re: [xsl] replacing nodes during xsl:copy-of From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Thu, 6 Jan 2011 14:15:52 +0000 |
> From a high-level, non-technical, viewpoint, what I need to do is convert the XML to HTML and either during the process, or after replace everything in the <replace> elements with something else. Ok this is your starting point - its an "identity transform" which copies the input to the output node by node. The more specific template which matches the "replace" element takes precedence over the "identity template": <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="replace"> [ something else ] </xsl:template> </xsl:stylesheet> If you run that transform on this input: <foo>hello <replace>world</replace></foo> you get this output: <foo>hello [ whatever ] </foo> -- Andrew Welch http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] replacing nodes during xs, David Carlisle | Thread | Re: [xsl] CSV data in attribute - h, Brandon Ibach |
Re: [xsl] match first occurrence fo, David Carlisle | Date | Re: [xsl] match first occurrence fo, David Carlisle |
Month |
Keywords