Tags in fetch-news are case-sensitive #1095

Slēgta
max.mehl atvēra 2019-10-04 19:12:17 +00:00 · 1 comment
Īpašnieks

I noticed a bug with the fetch-news template.

Example:

/activities/radiodirective/radiodirective.xsl calls fetch-news with the param tag "RadioDirective".

This however only includes news that have exactly this form of the tag as <tag>, so "radiodirective" or "Radiodirective" would not work. That's not good!

I tried to fix this in /tools/xsltsl/tagging.xsl by introducing something like (I shortened the actual code to make it clearer):

<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

<xsl:for-each select="/buildinfo/document/set/news[translate(tags/tag, $lower, $upper) = translate($tag, $lower, $upper))]">
   <!-- action! display news -->
</xsl:for-each>

However, that does not work, it just does not match any news any more. I suspect that this is because tags/tag does exist more than once, and the translation does not work. So it just seems to take the first tag (which often is front-page), but in the actual test it seems to compare all nodes.

I have no idea how to make this possible without unnecessarily looping over all news and all tags...

@reinhard or @jzarl, can you come to the rescue? ;)

I noticed a bug with the fetch-news template. Example: `/activities/radiodirective/radiodirective.xsl` calls fetch-news with the param `tag` "RadioDirective". This however only includes news that have exactly this form of the tag as `<tag>`, so "radiodirective" or "Radiodirective" would not work. That's not good! I tried to fix this in `/tools/xsltsl/tagging.xsl` by introducing something like (I shortened the actual code to make it clearer): ``` <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'" /> <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> <xsl:for-each select="/buildinfo/document/set/news[translate(tags/tag, $lower, $upper) = translate($tag, $lower, $upper))]"> <!-- action! display news --> </xsl:for-each> ``` However, that does not work, it just does not match any news any more. I suspect that this is because `tags/tag` does exist more than once, and the translation does not work. So it just seems to take the first tag (which often is front-page), but in the actual test it seems to compare all nodes. I have no idea how to make this possible without unnecessarily looping over **all** news and all tags... @reinhard or @jzarl, can you come to the rescue? ;)
max.mehl pievienoja
help wanted
tagging
etiķetes 2019-10-04 19:12:18 +00:00
Biedri

I'm working on #826 right now and in the course of this conversion, I converted all tag keys to lowercase. I think with the new tag syntax, it would be easier to understand that keys should be all lowercase, so let's try to keep it this way rather than complicate the XSL scripts by adding case conversions.

I'm working on #826 right now and in the course of this conversion, I converted all tag keys to lowercase. I think with the new tag syntax, it would be easier to understand that keys should be all lowercase, so let's try to keep it this way rather than complicate the XSL scripts by adding case conversions.
reinhard slēdza šo problēmu 2020-04-26 13:29:58 +00:00
Pierakstieties, lai pievienotos šai sarunai.
Nav atskaites punktu
Nav atbildīgo
2 dalībnieki
Paziņojumi
Izpildes termiņš
Datums līdz nav korekts. Izmantojiet formātu 'gggg-mm-dd'.

Izpildes termiņš nav uzstādīts.

Atkarības

Nav atkarību.

Atsaucas uz: FSFE/fsfe-website#1095
No description provided.