Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Mon, 21 Jan 2008 21:09:39 +0800,    group: microsoft.public.xsl        back       


Access on element on XML document by XSLT.   
Dear Sir,

I have below XML file 
------------ XML ------------
<tcm:Content>
    <Content xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396">
				<Question>Aandelenfonds</Question>
							</Content>
</tcm:Content>
------------ end of XML --------

I am trying to select the value on <Question> by XSLT, I used the value of 
tag as below

<xsl:value-of select="tcm:Content/Content/Question"/>

Apparently, it does not work out because of the 
xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396".

What should I do here?

regards, 

Guoqi Zheng
http://www.ureader.com

url:http://www.ureader.com/gp/1629-1.aspx
date: Mon, 21 Jan 2008 21:09:39 +0800   author:   guoqi zheng

RE: Access on element on XML document by XSLT.   
"guoqi zheng" wrote:

> Dear Sir,
> 
> I have below XML file 
> ------------ XML ------------
> <tcm:Content>
>     <Content xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396">
> 				<Question>Aandelenfonds</Question>
> 							</Content>
> </tcm:Content>
> ------------ end of XML --------
> 
> I am trying to select the value on <Question> by XSLT, I used the value of 
> tag as below
> 
> <xsl:value-of select="tcm:Content/Content/Question"/>
> 
> Apparently, it does not work out because of the 
> xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396".
> 
> What should I do here?
> 

You should add the attribute:-

xmlns:a="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396"

to the xsl:stylesheet element

Then your Xpath can be:-

<xsl:value-of select="tcm:Content/a:Content/a:Question"/>

I'm assuming there is already a namespace for the tcm alias defined in both 
the XML and the XSL files.

--
Anthony Jones - MVP ASP/ASP.NET
date: Mon, 21 Jan 2008 05:53:01 -0800   author:   Anthony Jones

Re: Access on element on XML document by XSLT.   
"guoqi zheng"  wrote in message 
news:9fd53bcba51b4677bb9d9bc2a2c0c14e@newspe.com...
> Dear Sir,
>
> I have below XML file
> ------------ XML ------------
> <tcm:Content>
>    <Content xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396">
> <Question>Aandelenfonds</Question>
> </Content>
> </tcm:Content>
> ------------ end of XML --------
>
> I am trying to select the value on <Question> by XSLT, I used the value of
> tag as below
>
> <xsl:value-of select="tcm:Content/Content/Question"/>
>
> Apparently, it does not work out because of the
> xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396".
>
> What should I do here?
>
> regards,
>
> Guoqi Zheng
> http://www.ureader.com
>
> url:http://www.ureader.com/gp/1629-1.aspx

The XML doesn't have the tcm prefix mapped to a namespace URI so your 
selection shouldn't work anyway bit assuming there is something you aren't 
showing then you need to read about the default namespace. See 
http://www.dpawson.co.uk/xsl/sect2/N5536.html especially numbers 13 and 23.

-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name
date: Mon, 21 Jan 2008 13:56:35 -0000   author:   Joe Fawcett am

Re: Access on element on XML document by XSLT.   
It works now.

Thank you

Regards,

Guoqi Zheng
Http://www.ureader.com

"Anthony Jones"  wrote in message 
news:D65EC4CF-B684-43CC-BDE4-BB9C06352FD2@microsoft.com...
>
>
> "guoqi zheng" wrote:
>
>> Dear Sir,
>>
>> I have below XML file
>> ------------ XML ------------
>> <tcm:Content>
>>     <Content xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396">
>> <Question>Aandelenfonds</Question>
>> </Content>
>> </tcm:Content>
>> ------------ end of XML --------
>>
>> I am trying to select the value on <Question> by XSLT, I used the value 
>> of
>> tag as below
>>
>> <xsl:value-of select="tcm:Content/Content/Question"/>
>>
>> Apparently, it does not work out because of the
>> xmlns="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396".
>>
>> What should I do here?
>>
>
> You should add the attribute:-
>
> xmlns:a="uuid:ACAB60FE-A0C2-4C97-BC61-914072147396"
>
> to the xsl:stylesheet element
>
> Then your Xpath can be:-
>
> <xsl:value-of select="tcm:Content/a:Content/a:Question"/>
>
> I'm assuming there is already a namespace for the tcm alias defined in 
> both
> the XML and the XSL files.
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
date: Mon, 21 Jan 2008 16:13:01 +0100   author:   guoqi zheng

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us