To check whether a particular node is comment or node Options
dhirajDac
Posted: Monday, January 21, 2008 2:17:04 PM
Rank: Newbie

Joined: 1/17/2008
Posts: 6
hi All,
I want to made a loop from root node but don;t take comment node...how can i check whether particular node is comment or else..
suppose i have a xml ..
<?xml version="1.0" encoding="UTF-8"?>
<!--
<?xml-stylesheet type="text/xsl" href="MetricConfig.xslt"?>
-->
<!-- This source code (including its associated software) is owned
by Altiris and is protected by United States and international
intellectual property law, including copyright laws, patent
laws, and treaty provisions.
-->
<config>
<metrics>

<metric type="COMMAND" name="Processor User Time% AIX" guid="{aeddddb7-43fb-49a1-8842-752eaf0d1f5d}">
<query>
<Command>
<CommandLine>LC_ALL=C /usr/bin/vmstat 1 2 | /usr/bin/awk '{if(!/^$|^System|^.*-/){print $0;}}'</CommandLine>
</Command>
<ParsingRules>
<LineNumbersToParse>1,3</LineNumbersToParse>
<Return>
<Column name="us" type="float"></Column>
</Return>
</ParsingRules>
</query>
<datatype>Numeric</datatype>
<interval>30000</interval>
<timeout>5000</timeout>
</metric>
</metrics>
</config>

i want to make a loop only from config but node() function takes comment also..
Please help me out..
dhirajDac
Posted: Tuesday, January 22, 2008 7:38:09 AM
Rank: Newbie

Joined: 1/17/2008
Posts: 6
Hi All,
I have done this by some R&D. for checking whether a particular node is comment or having inner node i have used self::* key.As for exampl:--

<xsl:template match="@*|node()">
<xsl:if test="self::*">
code for processing
</xsl:if>
</xsl:template>

Thanx
Bueno
Posted: Wednesday, January 23, 2008 5:45:39 PM
Rank: Newbie

Joined: 1/23/2008
Posts: 1
Dhiraj Kumar wrote:

<xsl:if test="self::*">
code for processing


other possible solution, which excludes comments, but processes al other nodes:
<xsl:if test="not(self::comment())">
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.