|
Subject: Re: [xsl] Grouping by attribute From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Tue, 20 Oct 2009 12:42:46 +0200 |
Now, what if I want to replace all <p>-tags with <para>, and change the namespace of all nodes to "foo"?
<document>
<metaData>
<title>Title</title>
<publisher>Publisher</publisher>
</metaData>
<contentSection>
<p>text</p> <headline level="2">Headline</headline>
<p>text</p>
<p>text</p> <headline level="2">Section</headline>
<p>text</p>
<pagenum id="page2"/>
<p>text</p>
<headline level="3">Subsection</headline>
<p>text</p> <headline level="2">Section</headline>
<p>text</p>
<p>text</p>
</contentSection>
</document><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.com/2009/mf" xmlns="http://example.com/foo" exclude-result-prefixes="xs mf">
<xsl:output indent="yes"/> <xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="p">
<para>
<xsl:apply-templates select="@* | node()"/>
</para>
</xsl:template><body xmlns="http://example.com/foo"> <level1> <h1>Title</h1> <para>text</para> <level2> <h2>Headline</h2> <para>text</para> <para>text</para> </level2> <level2> <h2>Section</h2> <para>text</para> <pagenum xmlns="" id="page2"/> <para>text</para> <level3> <h3>Subsection</h3> <para>text</para> </level3> </level2> <level2> <h2>Section</h2> <para>text</para> <para>text</para> </level2> </level1> </body>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Grouping by attribute, Jostein Austvik Jaco | Thread | Re: [xsl] Grouping by attribute, Jostein Austvik Jaco |
| Re: [xsl] Grouping by attribute, Jostein Austvik Jaco | Date | Re: [xsl] Grouping by attribute, Jostein Austvik Jaco |
| Month |