[Bug 2207] R-215: Whitespace and identity constraints

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2207





------- Comment #3 from Martin.vGagern@gmx.net  2007-09-12 10:16 -------
I would assume the following shell script should give correct patterns to fix
both this issue here and bug 2122.

S="\\s*"
NCName='[^\I:][^\C:]*'
QName="${NCName}:${NCName}"
NameTest="(child::${S})?(${NCName}:)?(${NCName}|\\*)"
Step="${S}(\\.|${NameTest})${S}"
Path="(${S}\\.${S}//)?${Step}(/${Step})*"
Selector="${Path}(\\|${Path})*"
echo "selector: ${Selector}"
LastStep="${Step}|${S}(@|attribute::)${S}${NameTest}${S}"
Path="(${S}\\.${S}//)?(${Step}/)*(${LastStep})"
Selector="${Path}(\\|${Path})*"
echo "field: ${Selector}"

With some linebreaks added, the resulting patterns look as follows.

selector: 
(\s*\.\s*//)?\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*
(/\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*)*
(\|(\s*\.\s*//)?\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*
(/\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*)*)*

field: 
(\s*\.\s*//)?(\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*/)*
(\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*
|\s*(@|attribute::)\s*(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*)\s*)
(\|(\s*\.\s*//)?(\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*/)*
(\s*(\.|(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*))\s*
|\s*(@|attribute::)\s*(child::\s*)?([^\I:][^\C:]*:)?([^\I:][^\C:]*|\*)\s*))*

Received on Wednesday, 12 September 2007 10:16:29 UTC