Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Exclusion of Xsl Processing for a particular Node Set >Thread Next - Re: Exclusion of Xsl Processing for a particular Node Set Re: Exclusion of Xsl Processing for a particular Node SetTo: NULL Date: 10/6/2006 12:53:00 AM
Hi,
There are many ways you can achieve that, one possibility is below.
That matches on elements that have at most one ancestor element and
replaces them with div and by default copies any node to the output.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="*[count(ancestor::*)<2]">
<div><xsl:apply-templates/></div>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com
deepak.programming@g... wrote:
> Dear All,
> I have a problem regarding Xsl Transformation. The Problem is
> that I want to apply xsl transformation till a level and after that i
> want that the original structure should be copied as it is. For ex.
>
> <node>
> <subNode>
> <childNode1>
> </childNode1>
> <childNode2>
> </childNode2>
> </subNode>
> </node>
> in the above xml only the xsl transformation should apply to node and
> subnode. After that the transformation should result in same node
> structure as it is given. somewhat like this
> <div> --- replaced node
> <div> -- replace subnode
> --structure as it is.
> <childNode1>
> </childNode1>
> <childNode2>
> </childNode2>
> </div>
> </div> Can any one tell me how to achieve that. thanks in advance.
> Deepak.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
