-1

I'm using XPath 3.0 and I've the following problem. I need to write a function that returns true/false, checking whether the names of the resources (files and folders) are such that all resources have a distinct pathname.

This is my Document Type Definition

I am able to retrieve the name of the ancestor nodes folders of a specific folder but then I cannot think of how to build a "path name" from that to then perform the comparison. Any idea?

Thomas W
  • 14,757
  • 6
  • 48
  • 67
Pagli
  • 31
  • 4

1 Answers1

0

The following expression checks whether there are any duplicate file/folder names in any folder. That should be sufficient to check whether there are no duplicate path names.

//*[self::RootFolder|self::Folder][count(distinct-values(*/Name))!=count(File|Folder)]

Additional checks to make sure the path separator is not used in any file/folder names would be required.

Thomas W
  • 14,757
  • 6
  • 48
  • 67