This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
scanning a tree (again)
- To: <xsl-list at mulberrytech dot com>
- Subject: scanning a tree (again)
- From: "Shlomi Sarfati" <shlomi at navixo dot com>
- Date: Sun, 3 Dec 2000 13:10:20 +0200
- Reply-To: xsl-list at mulberrytech dot com
I am sorry for sending this question again but I didn't got the answer that
I need maybe because I didn't explained my self !
I need to run an xsl stylesheet on my xml tree that do the following :
on every node in my xml tree I have a tag named 'modified' that tells me if
the current node has been modified.
I need to hold a flag that will tell me if one of the nodes has been
modified !
this flag will be the attribute of the first tag in my result tree. does it
means that I need to check the source tree first
for all the <modified> tags and then run my xsl (if so how should I do it
? )
can you do something like this ?
<xsl:variable name="valueofFlag"> false </xsl:variable>
<xsl:template match="/">
<head>
<xsl:element name="menu">
<xsl:attribute name="color">black</xsl:attribute>
<xsl:apply-templates/>
<xsl:attribute name="modified"> <xsl:copy-of select="$valueofFlag"/>
</xsl:attribute>
</xsl:element>
</head>
</xsl:template>
<xsl:template match="//child">
<xsl:choose>
<xsl:when test ="//*[@modified='true']"> <xsl:variable
name="valueofFlag"> true </xsl:variable> </xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
.
.
.
.
this is example of my xml :
<?xml version="1.0"?>
<data_xml>
<list>
<dynamic_menu_id>1003</dynamic_menu_id>
<PARENT_ID>1003</PARENT_ID>
<name>first child</name>
<position>1</position>
<modified>true</modified>
<object>
<dynamic_menu_id>1004</dynamic_menu_id>
<object_name>Accounting</BUTTON_NAME>
<position>1</position>
<modified/>
</object>
<object>
<dynamic_menu_id>1005</dynamic_menu_id>
<object_name>management</BUTTON_NAME>
<position>2</position>
<modified/>
</object>
<object>
<dynamic_menu_id>1006</dynamic_menu_id>
<object_name>xxxx</BUTTON_NAME>
<position>3</position>
<modified/>
</object>
<object>
<dynamic_menu_id>1007</dynamic_menu_id>
<object_name>yyy</BUTTON_NAME>
<position>4</position>
<modified/>
</object>
</list>
</data_xml>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list