Skip to content

Commit 67e938d

Browse files
namedgraphclaude
andcommitted
Fix acl:mode() regex — XPath F&O doesn't support lookahead or \b
Split Link header entries with xsl:analyze-string instead of tokenize($line, ',\s*(?=<)') and replace \brel with [;\s]rel — both constructs are absent from the XPath F&O regex flavor and Saxon rejected them at runtime (FORX0002). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1f9cf75 commit 67e938d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports/default.xsl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,16 @@ exclude-result-prefixes="#all"
116116
</xsl:template>
117117

118118
<xsl:function name="acl:mode" as="xs:anyURI*" use-when="system-property('xsl:product-name') = 'SAXON'">
119-
<xsl:variable name="entries" select="for $line in $ldh:httpHeaders('Link') return tokenize($line, ',\s*(?=&lt;)')" as="xs:string*"/>
120-
<xsl:sequence select="for $entry in $entries return if (matches($entry, '^&lt;[^&gt;]+&gt;\s*;.*\brel\s*=\s*&quot;?[^&quot;\s,;]*acl#mode&quot;?')) then xs:anyURI(replace($entry, '^&lt;([^&gt;]+)&gt;.*$', '$1')) else ()"/>
119+
<xsl:variable name="entries" as="xs:string*">
120+
<xsl:for-each select="$ldh:httpHeaders('Link')">
121+
<xsl:analyze-string select="." regex="&lt;[^&gt;]+&gt;[^&lt;]*">
122+
<xsl:matching-substring>
123+
<xsl:sequence select="."/>
124+
</xsl:matching-substring>
125+
</xsl:analyze-string>
126+
</xsl:for-each>
127+
</xsl:variable>
128+
<xsl:sequence select="for $entry in $entries return if (matches($entry, '^&lt;[^&gt;]+&gt;\s*;.*[;\s]rel\s*=\s*&quot;?[^&quot;\s,;]*acl#mode&quot;?')) then xs:anyURI(replace($entry, '^&lt;([^&gt;]+)&gt;.*$', '$1')) else ()"/>
121129
</xsl:function>
122130

123131
<xsl:function name="ac:uri" as="xs:anyURI?">

0 commit comments

Comments
 (0)