[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:copy
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|