Tags in fetch-news are case-sensitive #1095

Closed
opened 2019-10-04 19:12:17 +00:00 by max.mehl · 1 comment
Owner

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 added the
help wanted
tagging
labels 2019-10-04 19:12:18 +00:00
Member

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.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

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