all groups > dotnet xml > april 2006 >
You're in the

dotnet xml

group:

XSLT for an xml with namespace


XSLT for an xml with namespace shalini22 NO[at]SPAM gmail.com
4/6/2006 11:41:46 AM
dotnet xml:
HI

can anyone help me out with this, im a newbie to xml n stuff. i really
have tough time working on this .

Xml file:

<p:win32_Service xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://schemas.microsoft.com/wsman/2005/06/wmi/root/cimv2/win32_Service">
<p:AcceptPause>true</p:AcceptPause>
<p:AcceptStop>true</p:AcceptStop>
<p:Caption>Windows Management Instrumentation</p:Caption>
<p:StartMode>Auto</p:StartMode>
<p:StartName>LocalSystem</p:StartName>
<p:State>Running</p:State>
<p:Status>OK</p:Status>
<cim:Location xmlns:cim="http://schemas.dmtf.org/wsman/2005/06/base"


xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"
"http://schemas.xmlsoap.org/ws/2005/06/management">
<a:Addres>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Addres>
<a:ReferenceParameters>
<w:ResourceURI>http://schemas.microsoft.com/wsman/2005/06/wmi/root/cimv2/win32_Service</w:ResourceURI>
<w:SelectorSet>
<w:Selector>Winmgmt</w:Selector>
</w:SelectorSet>
</a:ReferenceParameters>
</cim:Location>
</p:win32_Service>

[quoted text, click to view]
StartName elements.

So i wrote an xsl code, which goes something like this

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cim="http://schemas.dmtf.org/wsman/2005/06/base"

xmlns:p="http://schemas.microsoft.com/wsman/2005/06/wmi/root/cimv2/win32_Service">

<xsl:output method="text"/>

<xsl:template match="/">
<xsl:apply-templates select="//p:Status|//p:Caption"/>
</xsl:template>

<xsl:template match="cim:Location"/>
<xsl:template match="p:Status">
<xsl:value-of select="p:Status" />
</xsl:template>
<xsl:template match="p:Caption">
<xsl:value-of select="p:Caption" />
</xsl:template>
</xsl:stylesheet>


When i run these two files in vbscript code, i cannot see any output??
i am trying to figure it out since a long time.

I appreciate if anyone can help me with this.


Regards
Re: XSLT for an xml with namespace Martin Honnen
4/9/2006 3:35:58 PM


[quoted text, click to view]


[quoted text, click to view]

Make that
<xsl:value-of select="." />

[quoted text, click to view]

Same here
<xsl:value-of select="." />



--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button