[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Multiple Template Matchingm, Attributes & Complex

Subject: Re: Multiple Template Matchingm, Attributes & Complex XML
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 25 Feb 2011 18:43:57 +0100
Re:  Multiple Template Matchingm
Jeffry Proctor wrote:
ASP.Net 2008, Linq XmlCompiledTransform, XSLT ver 1.0 I assume?

1. Limited as I am, the Person node/element&  attribute is updating correctly;
How do I add other node/element?
I assume it will be to remove Person as the top level match, but I'm not finding
examples for making XML, many for HTML and mutilple tables sometimes nesting,
but for some reason that doesn't speak to me.

If you want to tranform XML to XML and you want to copy some elements, add some other, maybe delete some other then start with the template

<xsl:template match="@* | node()">
    <xsl:apply-templates select="@* | node()"/>

That is the identity transformation template that (on its own) copies the input tree to the result tree, node by node, level by level.

Now you can add templates for the element nodes you want to change e.g.

  <xsl:template match="foo">
    <!-- make this a 'bar' element -->
      <xsl:apply-templates select="@* | node()"/>

  <xsl:template match="baz">
    <!-- copy but add new child -->
      <xsl:apply-templates select="@* | node()"/>

or for the ones you want to delete e.g.
  <!-- don't copy 'foobar' -->
  <xsl:template match="foobar"/>

Does that help? If not then please post a sample of the input you have and the output you want to create from it.


	Martin Honnen

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.