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

Very Basic Generic Filtering Question

Subject: Very Basic Generic Filtering Question
From: Arvind Bassi <arvind_bassi@xxxxxxxxxxx>
Date: Thu, 10 Jun 2004 23:06:28 +0100 (BST)
generic filtering
I haven't done XSLT for quite some time, and its amazing how much l
have forgotten.

I have a very simple problem of having to filter out a specific xml
element. In the example below, it is <Header>, but it should be able to
be passed down as a parameter. From memory, l need to use the name
function and test it against the current node, but l have tried doing
this but to no avail.

How can the following xml document be filtered in a generic manner?


<?xml version="1.0" encoding="UTF-8"?>
<AddressBook>
    <Header>
        <ElementOne id="1">hello</ElementOne>
        <ElementTwo id="2"> why not</ElementTwo>
    </Header>
    <People value="3">
        <Name number="3">
            <FirstName> Simon</FirstName>
            <LastName>Says</LastName>
        </Name>
        <Name number="3">
            <FirstName> Simon</FirstName>
            <LastName>Says</LastName>
        </Name>
        <Name number="3">
            <FirstName> Simon</FirstName>
            <LastName>Says</LastName>
        </Name>
        <Name number="3">
            <FirstName> Simon</FirstName>
            <LastName>Says</LastName>
        </Name>
    </People>
    <Mary>
        <Had a="little"> lamb</Had>
    </Mary>
</AddressBook>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes" method="xml" version="1.0"/>
    <xsl:param name="filterElement">Header</xsl:param>
    <xsl:template match="/">
        <xsl:copy>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="???????">
        <xsl:copy-of select="."/>
    </xsl:template>
    <xsl:template match="????????"/>
</xsl:stylesheet>

Any help that can be provided would be gratefully appreciated.

Thanks.

Arvind.





	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com

Current Thread

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.