Skip to content

Commit

Permalink
Don't set @about on the container until after the resource is saved
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed May 26, 2024
1 parent 4e4ddde commit 505bd39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ exclude-result-prefixes="#all"

<xsl:variable name="content-id" select="$container/@id" as="xs:string"/>
<xsl:variable name="block-uri" select="$container/@about" as="xs:anyURI"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[@about][contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-property" select="xs:anyURI('&rdf;_' || $sequence-number)" as="xs:anyURI"/>
<xsl:message>$sequence-number: <xsl:value-of select="$sequence-number"/> $sequence-property: <xsl:value-of select="$sequence-property"/></xsl:message>
<xsl:variable name="update-string" select="$block-update-string" as="xs:string"/>
Expand Down Expand Up @@ -721,7 +721,7 @@ exclude-result-prefixes="#all"
<xsl:variable name="block-uri" select="$container/@about" as="xs:anyURI"/>
<xsl:variable name="value-uri" select="$value-input => ixsl:get('value')" as="xs:anyURI"/>
<xsl:variable name="mode-uri" select="$mode-input => ixsl:get('value')" as="xs:anyURI?"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[@about][contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-property" select="xs:anyURI('&rdf;_' || $sequence-number)" as="xs:anyURI"/>
<xsl:message>$sequence-number: <xsl:value-of select="$sequence-number"/> $sequence-property: <xsl:value-of select="$sequence-property"/></xsl:message>
<xsl:variable name="update-string" select="$block-update-string" as="xs:string"/>
Expand Down Expand Up @@ -767,7 +767,7 @@ exclude-result-prefixes="#all"
<xsl:variable name="block-uri" select="$container/@about" as="xs:anyURI"/>
<xsl:variable name="query-uri" select="$query-input => ixsl:get('value')" as="xs:anyURI"/>
<xsl:variable name="mode-uri" select="$mode-input => ixsl:get('value')" as="xs:anyURI?"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[@about][contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-property" select="xs:anyURI('&rdf;_' || $sequence-number)" as="xs:anyURI"/>
<xsl:message>$sequence-number: <xsl:value-of select="$sequence-number"/> $sequence-property: <xsl:value-of select="$sequence-property"/></xsl:message>
<xsl:variable name="update-string" select="$block-update-string" as="xs:string"/>
Expand Down Expand Up @@ -967,7 +967,7 @@ exclude-result-prefixes="#all"
<xsl:variable name="content-value" select="$query-uri" as="xs:anyURI"/>
<xsl:variable name="content-id" select="$container/@id" as="xs:string"/>
<xsl:variable name="block-uri" select="$container/@about" as="xs:anyURI"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-number" select="count($container/preceding-sibling::div[@about][contains-token(@class, 'content')]) + 1" as="xs:integer"/>
<xsl:variable name="sequence-property" select="xs:anyURI('&rdf;_' || $sequence-number)" as="xs:anyURI"/>
<xsl:message>$sequence-number: <xsl:value-of select="$sequence-number"/> $sequence-property: <xsl:value-of select="$sequence-property"/></xsl:message>
<xsl:variable name="update-string" select="$block-update-string" as="xs:string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ WHERE
<xsl:result-document href="?." method="ixsl:replace-content">
<xsl:copy-of select="$row/*"/>
</xsl:result-document>

<xsl:message>
Existing @about: <xsl:value-of select="@about"/>
</xsl:message>
<ixsl:set-attribute name="about" select="$row/@about'"/>
</xsl:for-each>

<xsl:apply-templates select="id($row//form/@id, ixsl:page())" mode="ldh:PostConstruct"/>
Expand Down Expand Up @@ -785,6 +790,7 @@ WHERE
<xsl:variable name="constraints" select="if (exists($types)) then document($request-uri) else ()" as="document-node()?"/>

<xsl:apply-templates select="$constructed-doc" mode="bs2:Form"> <!-- document level template -->
<xsl:with-param name="about" select="()"/> <!-- don't set @about on the container until after the resource is saved -->
<xsl:with-param name="method" select="'post'"/> <!-- browsers do not allow PUT form method -->
<xsl:with-param name="action" select="ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $doc-uri)" as="xs:anyURI"/>
<xsl:with-param name="form-actions-class" select="'form-actions modal-footer'" as="xs:string?"/>
Expand Down Expand Up @@ -878,6 +884,7 @@ WHERE
<xsl:variable name="shapes" select="document($request-uri)" as="document-node()"/>

<xsl:apply-templates select="$constructed-doc" mode="bs2:RowForm">
<xsl:with-param name="about" select="()"/> <!-- don't set @about on the container until after the resource is saved -->
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="action" select="ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $doc-uri)" as="xs:anyURI"/>
<xsl:with-param name="classes" select="$classes"/>
Expand Down

0 comments on commit 505bd39

Please sign in to comment.