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

Re: xsl:copy

Subject: Re: xsl:copy
From: "Marrow" <marrow@xxxxxxxxxxxxxx>
Date: Sat, 6 Jul 2002 14:25:40 +0100
xsl copy lang
Hi,

Something like...

== XSL1 ==================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="copy-lang">en</xsl:param>
  <xsl:template match="/|@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="(@*|node())[descendant-or-self::*[@lang =
$copy-lang] or not(@lang)]"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
== end of XSL1 =============================

or, if your were using the @xml:lang attribute, e.g.

== XML2 ==================================
<?xml version="1.0"?>
<!-- comment -->
<?pitest xxx?>
<page>
  <title xml:lang="tr">Hoºgeldiniz</title>
  <title xml:lang="en">Wellcome</title>
  <description>
    assafs aszdfsd
    <sub-desc xml:lang="en">enenen</sub-desc>
    <sub-desc xml:lang="tr">trtrtr</sub-desc>
  </description>
  <test att1="abc" xml:lang="en">ABC</test>
  <test att1="xyz" xml:lang="tr">XYZ</test>
</page>
== end of XML2 =============================

then something like...

== XSL2 ==================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="copy-lang">en</xsl:param>
  <xsl:template match="/|@*|node()">
    <xsl:copy>
      <xsl:apply-templates
select="(@*|node())[descendant-or-self::*[lang($copy-lang)] or
not(@xml:lang)]"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
== end of XSL2 =============================

Cheers
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • xsl:copy
    • Cenk Uysal - Sat, 6 Jul 2002 08:21:19 -0400 (EDT)
      • <Possible follow-ups>
      • Marrow - Sat, 6 Jul 2002 09:27:41 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.