Hi,

I am trying to parse an xml which i am getting in a variable in my xsl. till the time i do not have any namespace in my xml i can parse all the tags of my xml from my xsl, however, for any tag with a namespace i could not parse it. not sure why is it so.. Please assist.

XML:-
<?xml version="1.0" encoding="utf-16"?>
<feed xmlns:es="http://ucmservice">
     <Title>XSL</Title>
       <Updated>2010-2-23T12:00:00Z</Updated>
        <Author><Name>UCM</Name></Author>
        <element>
            <Link>http://ucmservice</Link>
            <Id>001</Id>
            <Updated>2010-2-23T12:00:00Z</Updated>
            <es:RepositoryDetails>
                <es:Repository Type="Test" />
            </es:RepositoryDetails>
            <es:DocProperties>
                <es:DocProperty propertyName="Title">
                    <es:PropValues>
                        <es:PropValue>22172</es:PropValue>
                    </es:PropValues>
                </es:DocProperty>
            </es:DocProperties>
        </element>
 </feed>

XSL:-

<?xml version="1.0"?> 
<xsl:stylesheet version="1.0"
	xmlns="http://www.w3.org/2005/Atom"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:es="http://ucmservice"
    exclude-result-prefixes="java wcm">

<xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>	
<xsl:param name="relatedDocumentsXML" /> <!-- in this variable i am getting the XML-->
<xsl:template match="/">
<xsl:apply-templates select="$relatedDocumentsXML/feed" />
</xsl:template>

<xsl:template match="feed">

<xsl:for-each select="element">
	<xsl:apply-templates select="."></xsl:apply-templates>
		</xsl:for-each>
</xsl:template>

<xsl:template match="element">
<xsl:for-each select="Id">				<xsl:value-of select="." /> <!-- i am getting the value for this ID-->
</xsl:for-each>
<xsl:for-each select="es:RepositoryDetails/es:Repository">
		<xsl:value-of select="@Type" /> <!-- not able to get the value for this. Seems like an issue with namespace. Please assist-->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

TIA

Hi,
First sorry for my poor english.


Your XSLT is good.
I only have one problem when I make test with

exclude-result-prefixes="java wcm"

Xmlspy don't like but i don't think it's the error.

I must make one change for testing

<xsl:param name="relatedDocumentsXML" />

by

<xsl:param name="relatedDocumentsXML" select="/*" />

May be your problems it's here.
Are you sure that your xml is well given in parameter ?

Thanks Erwan,
I'll try this.

I got the desired result, surprisingly by removing the namespace at the time of calling the tag. :)

Thanks once again.

Regards.

This question has already been answered. Start a new discussion instead.