warnings on matching elements with names that match xpath keywords

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

warnings on matching elements with names that match xpath keywords

David Carlisle

Low priority feature request...


For some time saxon has warned about usage such as select="true"
requiring child::true but this has been extended more in recent releases
(I'm testing with 9.8 but I may not have used all the 9.7 series, so not
sure when this was added exactly)

so I now get (for example)

The keyword 'default' in this context means 'child::default'. If
this was intended,
use 'child::default' or './default' to avoid this warning.

The keyword 'case' in this context means 'child::case'. If this was
intended, use
'child::case' or './case' to avoid this warning.

The keyword 'to' in this context means 'child::to'. If this was
intended, use
'child::to' or './to' to avoid this warning.

and so on...

It's sort of simple enough to go through the stylesheet adding child::
as suggested but it does tend to distort the xpaths for example

<xsl:apply-templates select="* except (var,from,to)"/>

it's enough to silence the warning to have

<xsl:apply-templates select="* except (var,from,child::to)"/>

but that makes it look like the structure of <to> is somehow different
so I end up with


<xsl:apply-templates select="* except
(child::var,child::from,child::to)"/>

which is OK but not what I'd ever have written "first time"


I can well believe that the number of people using select="true" when
they meant select="true()" far outweigh the number of people who have
elements <true/> and <false/> in their input source, so I can see that
in general having a warning is going to be a good thing, but would it be
possible to have a simple commandline option (or java configuration
setting) to say never issue these warnings?

(I assume I could use the java api and write a message handler that
filtered these but my xpath is rather better than my java so if that's
the only possibility I'd probably stick to adding child:: everywhere.)

Sorry if I missed an existing option for this, I did look, but didn't
see anything.

David


Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: warnings on matching elements with names that match xpath keywords

Michael Kay
Good idea, will appear in the next maintenance release.


Use --suppressXPathWarnings:on on the command line, or FeatureKeys.SUPPRESS_XPATH_WARNINGS in the Java API.

This will suppress all warnings from the XPath/XQuery parser, but I think most of the other cases are XQuery only (e.g. using an unrecognized pragma or serialization property).

Michael Kay
Saxonica

On 19 Jun 2017, at 14:13, David Carlisle <[hidden email]> wrote:


Low priority feature request...


For some time saxon has warned about usage such as select="true"
requiring child::true but this has been extended more in recent releases
(I'm testing with 9.8 but I may not have used all the 9.7 series, so not
sure when this was added exactly)

so I now get (for example)

The keyword 'default' in this context means 'child::default'. If
this was intended,
use 'child::default' or './default' to avoid this warning.

The keyword 'case' in this context means 'child::case'. If this was
intended, use
'child::case' or './case' to avoid this warning.

The keyword 'to' in this context means 'child::to'. If this was
intended, use
'child::to' or './to' to avoid this warning.

and so on...

It's sort of simple enough to go through the stylesheet adding child::
as suggested but it does tend to distort the xpaths for example

<xsl:apply-templates select="* except (var,from,to)"/>

it's enough to silence the warning to have

<xsl:apply-templates select="* except (var,from,child::to)"/>

but that makes it look like the structure of <to> is somehow different
so I end up with


<xsl:apply-templates select="* except
(child::var,child::from,child::to)"/>

which is OK but not what I'd ever have written "first time"


I can well believe that the number of people using select="true" when
they meant select="true()" far outweigh the number of people who have
elements <true/> and <false/> in their input source, so I can see that
in general having a warning is going to be a good thing, but would it be
possible to have a simple commandline option (or java configuration
setting) to say never issue these warnings?

(I assume I could use the java api and write a message handler that
filtered these but my xpath is rather better than my java so if that's
the only possibility I'd probably stick to adding child:: everywhere.)

Sorry if I missed an existing option for this, I did look, but didn't
see anything.

David


Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help