What messages do you get if you add the option -t?
 
Do you get any warnings if you switch to on-error=warning in the collection URI?
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay



From: Costello, Roger L. [mailto:costello@mitre.org]
Sent: 11 March 2010 16:08
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Rename all the elements/attributes in all the XMLfiles in a folder -- nothing happens

The question of whether or not updated documents are written back to disk depends on how you invoke the query, which you haven't described. There are various options on the command line, and if you use the Java API it is entirely under your control.

 

I am running it from the command line. Here’s how I invoke SAXON:

 

java -classpath %CLASSPATH% net.sf.saxon.Query -update:on -tree:linked -backup:on  FitnessCenter.xu

 

Where FitnessCenter.xu contains this:

 

for $i in collection('files?select=*.xml;recurse=yes;on-error=ignore')//(*|@*)

    return rename node $i as lower-case(name($i))

 

As I mentioned, I get no output and no changes to the XML files in the folder, “files”

 

 

/Roger

 

From: Michael Kay [mailto:mike@saxonica.com]
Sent: Thursday, March 11, 2010 10:18 AM
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Rename all the elements/attributes in all the XML files in a folder -- nothing happens

 

The question of whether or not updated documents are written back to disk depends on how you invoke the query, which you haven't described. There are various options on the command line, and if you use the Java API it is entirely under your control.

 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay

 


From: Costello, Roger L. [mailto:costello@mitre.org]
Sent: 11 March 2010 12:46
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Rename all the elements/attributes in all the XML files in a folder -- nothing happens

Hi Michael,

 

I am trying to rename all the elements and attributes in all the XML files in a folder. It seems like this should work:

 

for $i in collection('files?select=*.xml;recurse=yes;on-error=ignore')//(*|@*)

    return rename node $i as lower-case(name($i))

  

But I get no output and no change to the files.

 

I seem to be accessing all the files correctly because I get the expected output when I simply select all the elements in all the files:

 

for $i in collection('files?select=*.xml;recurse=yes;on-error=ignore')//*

    return $i

 

I am using the latest version of SAXON. Am I doing something wrong or is this a bug?

 

/Roger