#1095 Tags in fetch-news are case-sensitive

Closed
opened 1 year ago by max.mehl · 1 comments
max.mehl commented 1 year ago

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
label 1 year ago
max.mehl added the
tagging
label 1 year ago
reinhard commented 7 months ago
Collaborator

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 closed this issue 7 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.