|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: scanning a tree (again)
> 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 !
Yes, I didn't understand your question first time around and I'm not sure I
fully understand it now.
> 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.
By "every node" do you mean "every element"?
By "xml tree" do you mean an XPath tree, or a DOM tree? How is this tree
constructed?
By "tag" do you mean "attribute?"
> I need to hold a flag that will tell me if one of the nodes has been
> modified !
You can set a variable as follows:
<xsl:variable name="modified" select="//*[@modified]"/>
This boolean variable will be true if any element on the source tree has a
"modified" attribute.
> this flag will be the attribute of the first tag in my result
> tree.
You can write this to the output using something like:
<first-element>
<xsl:attribute>
<xsl:choose>
<xsl:when test="$modified">yes</xsl:when>
<xsl:otherwise>no</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
...
</first-element>
> can you do something like this ?
>
>
> <xsl:variable name="valueofFlag"> false </xsl:variable>
>
> <xsl:when test ="//*[@modified='true']"> <xsl:variable
> name="valueofFlag"> true </xsl:variable> </xsl:when>
You can do it, but it won't have the desired effect. XSLT is a language free
of side-effects, it doesn't have a conventional assignment statement. Your
xsl:when is creating a new variable, which goes out of scope immediately. It
is not modifying the value of the global variable.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








