Are you experiencing an issue with...
:beetle: Description
XML: https://raw.githubusercontent.com/flathub/io.github.Cockatrice.cockatrice/master/io.github.Cockatrice.appdata.xml
Query: string(//releases/release/@version)
I used https://www.freeformatter.com/xpath-tester.html as helper with the query and it works there.
I want to display 2.7.0 from the above xml source.
The value/string is located in the version attribute of the release node/key.
:link: Link to the badge
https://img.shields.io/badge/dynamic/xml.svg?color=4ac41d&label=version%20in%20appdata.xml&query=string%28%2F%2Freleases%2Frelease%2F%40version%29&url=https%3A%2F%2Fraw.githubusercontent.com%2Ftooomm%2Fio.github.Cockatrice.cockatrice%2Fmaster%2Fio.github.Cockatrice.appdata.xml
Hi, thanks for the report.
Huh, I wonder what is happening here. It’s strange that it says “internal error” and not “shields internal error.”
The Dynamic XML tests are currently failing (see #3089) so fixing that is probably the first order of business.
It seems like it may just be the XPath functions which are not working:
https://img.shields.io/badge/dynamic/xml.svg?color=4ac41d&label=version%20in%20appdata.xml&query=//releases/release/@version&url=https://raw.githubusercontent.com/flathub/io.github.Cockatrice.cockatrice/master/io.github.Cockatrice.appdata.xml
You used the query //releases/release/@version without the "string()" wrapping.
According to https://www.freeformatter.com/xpath-tester.html, that should return Attribute='version=2.7.0', but it doesn't...
I can workaround that for now, but will this be fixed?
Or is the xpath tester reporting incorrectly?
Hmm, i'm not too familiar with xPath, i usually use http://xpather.com/ to evaluate my queries.
So it may be that the other site is reporting incorrectly, or the site i'm using is.
But I think based on these results we should maybe link to http://xpather.com/ on the shields.io homepage?
I'm not experienced with xPath either.
You could rename the issue, ask for clarification and leave it open?
Sounds better to me than only assume one is right?
But yes, for now I would add your link as it matches the current behaviour.
It looks like XPath functions in general are not supported?
I couldn't use count() either.
Recently @calebcartwright fixed https://github.com/badges/shields/issues/4017 and https://github.com/badges/shields/issues/3814 by https://github.com/badges/shields/pull/4041. Both was caused by xpath funcions, it's described in the PR and summarized here https://github.com/badges/shields/pull/4041#pullrequestreview-298987257.
Functions are still not supported but I think it would be easy to implement it. I will do it.
@tooomm Shields now supports XPath functions in dynamic XML badge:
https://img.shields.io/badge/dynamic/xml?color=4ac41d&label=version%20in%20appdata.xml&query=string(%2F%2Freleases%2Frelease%2F%40version)&url=https%3A%2F%2Fraw.githubusercontent.com%2Fflathub%2Fio.github.Cockatrice.cockatrice%2Fmaster%2Fio.github.Cockatrice.appdata.xml
Thanks for fixing, and especially for letting me know @platan! Cool 👍
Most helpful comment
Recently @calebcartwright fixed https://github.com/badges/shields/issues/4017 and https://github.com/badges/shields/issues/3814 by https://github.com/badges/shields/pull/4041. Both was caused by xpath funcions, it's described in the PR and summarized here https://github.com/badges/shields/pull/4041#pullrequestreview-298987257.
Functions are still not supported but I think it would be easy to implement it. I will do it.