BizTalk Utilities CV ,   Jobs ,   Code library  
 
 
Page 13 of 15

 

Previous Page Table Of Contents Next Page

XSL Transformations, cont.

Copying Nodes

You can use the <xsl:copy> element to copy nodes, specifying just what parts you want to copy. The default rule for elements is that only the text in the element is copied. However, you can change that with <xsl:copy>, which can copy whole elements, text nodes, attributes, processing instructions and more, as you direct.

Here's an example; in this case, I'll strip all comments, processing instructions, and attributes out of planets.xml, simply by copying only text and elements:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 

<xsl:template match="* | text()">

    <xsl:copy>

        <xsl:apply-templates select="* | text()"/>

    </xsl:copy>

</xsl:template>

 

</xsl:stylesheet>

Here's the output of this transformation:

<?xml version="1.0" encoding="UTF-8"?>

<PLANETS>

 

  <PLANET>

    <NAME>Mercury</NAME>

    <MASS>.0553</MASS>

    <DAY>58.65</DAY>

    <RADIUS>1516</RADIUS>

    <DENSITY>.983</DENSITY>

    <DISTANCE>43.4</DISTANCE>

  </PLANET>

    .

    .

    .

 

Page 13 of 15

 

Previous Page Table Of Contents Next Page
 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
conference calling
swimming pool builder
spfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP