Skip to content

Commit

Permalink
GMP doc: GET_FILTERS: fix duplicate FILTERS in HTML
Browse files Browse the repository at this point in the history
Currently E in PATTERN refers to an ELE by NAME. Extend E
to refer to the ELE by ID. ID takes preference over NAME.

Also select only one ELE for E.

This allows adding an ID to the second FILTERS ELE in GET_FILTERS,
preventing the two FILTERS from being merged and duplicated by
the HTML XSL.
  • Loading branch information
mattmundell authored and timopollmeier committed Dec 2, 2024
1 parent 21dec6c commit 993a755
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/schema_formats/HTML/HTML.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</xsl:when>
<xsl:when test="name() = 'e'">
<li>
<xsl:variable name="element-name" select="text()"/>
<xsl:variable name="element-name-or-id" select="text()"/>
<!-- | appends right to left and [1] limits to one ele.
So if an ele with <id> is present it will override an ele with <name>. -->
<xsl:variable name="new-line-element"
select="$line-element/ele[name=$element-name]"/>
select="($line-element/ele[id=$element-name-or-id]|$line-element/ele[name=$element-name-or-id])[1]"/>
<xsl:choose>
<xsl:when test="$new-line-element">
&lt;<b><xsl:value-of select="text()"/></b>&gt;
&lt;<b><xsl:value-of select="$new-line-element/name"/></b>&gt;
<xsl:value-of select="$element-suffix"/>
<xsl:if test="$new-line-element/type">
<div style="margin-left: 15px; display: inline;">(<xsl:apply-templates select="$new-line-element/type" mode="element"/>)</div>
Expand All @@ -611,6 +613,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="element-name" select="text()"/>
<xsl:variable name="global-element"
select="/protocol/element[name=$element-name]"/>
&lt;<a href="#element_{$global-element/name}"><b><xsl:value-of select="text()"/></b></a>&gt;
Expand Down
3 changes: 2 additions & 1 deletion src/schema_formats/XML/GMP.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11773,7 +11773,7 @@ END:VCALENDAR
<any><e>filter</e></any>
<e>filters</e>
<e>sort</e>
<e>filters</e>
<e>filters2</e>
<e>filter_count</e>
</pattern>
<ele>
Expand Down Expand Up @@ -12030,6 +12030,7 @@ END:VCALENDAR
</ele>
</ele>
<ele>
<id>filters2</id>
<name>filters</name>
<pattern>
<attrib>
Expand Down

0 comments on commit 993a755

Please sign in to comment.