Re: [xsl] How to Get Nested Nodes

Subject: Re: [xsl] How to Get Nested Nodes
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Thu, 22 Dec 2011 10:22:31 +0100
See below

On 22 December 2011 09:29, Jeffry Proctor <jpgmt@xxxxxxxxxxxxx> wrote:
>
> List of Contacts from: feed/entry/content/Contacts
>
> Ultimately I would like to use a few XSLT's to extract different datasets,
my C#
> component, will just have a few functions, be somewhat xml, xslt agnostic,
> getting the function's corresponding XSLT from an xml (think ini file) to
> transfrom and return the datasets from the resulting xml; I'm choosing this
over
> a static looping/switch/case node= xpath walking, if anything changes I'd
have
> to re-code, I'd rather just update the offending xslt(s) and push that out
to
> the client, no install or dll issues, but I digress...


...?


>
>
> I'm trying to get a list of contacts from the following xml source
>

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:jp="http://sites.google.com/site/jeffryproctor/";>
    <xsl:template match="/">
        <ContactList xmlns="http://www.w3.org/2005/Atom"; >
            <contacts>
                <xsl:apply-templates select="/*"/>
            </contacts>
        </ContactList>
    </xsl:template>

    <xsl:template match="*">
         <xsl:apply-templates select="*"/>
    </xsl:template>

    <xsl:template match="jp:Contact">
            <Contact>
                <id>
                    <xsl:value-of select="@id"/>
                </id>
                <name>
                    <xsl:value-of select="jp:name"/>
                </name>
                <emailAddress>
                    <xsl:value-of select="jp:emailAddress"/>
                </emailAddress>
                <status>
                    <xsl:value-of select="jp:status"/>
                </status>
            </Contact>
    </xsl:template>
</xsl:stylesheet>

-W

Current Thread