Hi Alexander,
since you are replacing doc("categories")/categories/[EMAIL PROTECTED]/@idx
(attribute idx)
you need to set a trigger on it. Currently your trigger is set on
doc("categories")/categories and will fire when you replace the whole
categories subtree (rooted with 'categories' node).
CREATE TRIGGER "update_categories_timestamp"
AFTER REPLACE
ON doc("categories")/categories/category/@idx
FOR EACH STATEMENT
DO
{
UPDATE replace $b in doc("categories")/categories/@
timestamp with attribute timestamp {current-dateTime()};
}
Hope this helps
Maria Grineva
Sedna team
2008/12/7 Alexander Kardailsky <[EMAIL PROTECTED]>
> Dear Sedna-discussion,
>
> I use sedna-3.1.99.
> I have created the following document:
> <?xml version="1.0" standalone="yes"?>
> <categories timestamp="">
> <category id="8" idx="10"/>
> <category id="7" idx="8">
> <category id="9" idx="9"/>
> </category>
> <category id="4" idx="7"/>
> <category id="2" idx="1">
> <category id="3" idx="2">
> <category id="5" idx="3"/>
> </category>
> <category id="6" idx="4"/>
> <category id="11" idx="6"/>
> <category id="10" idx="5"/>
> </category>
> <category id="1" idx="0"/>
> </categories>
>
> Then I want to update timestamp each time I made replaces in subnodes.
> I tried the following:
> CREATE TRIGGER "update_categories_timestamp"
> AFTER REPLACE
> ON doc("categories")/categories
> FOR EACH STATEMENT
> DO
> {
> UPDATE replace $b in doc("categories")/categories/@timestamp with attribute
> timestamp {current-dateTime()};
> }
>
> But it seems doesn't work. When I did:
> update replace
> $cat in doc("categories")/categories/[EMAIL PROTECTED]/@idx
> with attribute idx {99}
> timestamp wasn't updated.
>
> Am I missing something?
> Thanks.
>
> --
> Best regards,
> Alexander
>
>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you. Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
>
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Sedna-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion