Skip to content

Commit dd462d8

Browse files
namedgraphclaude
andcommitted
Complete Prep 1 tail and Prep 3 tail for form/modal/constructor handlers
Prep 1 tail (imports/default.xsl): - Add xml:lang on lang-tagged <dd> in xhtml:DefinitionDescription - Add typed-literal template emitting @datatype on <dd> - Add data-role="subject" + hidden (replaces style="display:none") on both subject FormControl divs - Add @Property="{$this}" on the generic bs2:FormControl wrapper div so handlers can anchor on ancestor::*[@Property][1] Prep 3 tail (constructor.xsl, form.xsl, modal.xsl): Bootstrap-class anchors → RDFa/@Property: - constructor.xsl: control-group match + ancestor lookup → @Property; descendant collection and xsl:iterate selector → div[@Property] - form.xsl: last control-group select → div[@Property]; ancestor row-fluid/@typeof → ancestor::*[@typeof][1]/@typeof; add-constructor match + container param → ancestor::*[@typeof][1]; type-typeahead container ��� ancestor::*[@typeof][1]; description tooltip lookup → ancestor::*[@Property] - modal.xsl: two descendant control-group collections → div[@Property]; four specific property lookups (ldh:service, sp:limit, sioc:has_parent, sd:name) → div[@Property='<uri>'] (direct RDFa identity, no hidden input scan) CSS readback → ARIA: - form.xsl btn-edit-subj: ixsl:style(.)?display='none' toggle replaced with @hidden attribute check; subject row addressed via ancestor::fieldset/div[@data-role='subject'] instead of ancestor::legend/following-sibling::div (depth-locked axis removed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 50c7a54 commit dd462d8

4 files changed

Lines changed: 41 additions & 33 deletions

File tree

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/constructor.xsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ exclude-result-prefixes="#all"
481481
</xsl:template>
482482

483483
<!-- appends new triple template -->
484-
<xsl:template match="div[contains-token(@class, 'control-group')]//button[contains-token(@class, 'create-action')][contains-token(@class, 'add-triple-template')]" mode="ixsl:onclick">
485-
<xsl:variable name="container" select="ancestor::div[contains-token(@class, 'control-group')]" as="element()"/>
484+
<xsl:template match="button[contains-token(@class, 'create-action')][contains-token(@class, 'add-triple-template')][ancestor::*[@property][1]]" mode="ixsl:onclick">
485+
<xsl:variable name="container" select="ancestor::*[@property][1]" as="element()"/>
486486
<xsl:variable name="controls" as="node()*">
487487
<xsl:call-template name="ldh:ConstructorPredicate">
488488
<xsl:with-param name="predicate" select="()"/>
@@ -538,7 +538,7 @@ exclude-result-prefixes="#all"
538538
<xsl:template match="form[contains-token(@class, 'constructor-template')]//div[contains-token(@class, 'form-actions')]/button[contains-token(@class, 'btn-save')]" mode="ixsl:onclick">
539539
<xsl:variable name="form" select="ancestor::form" as="element()"/>
540540
<xsl:variable name="type" select="$form/@about" as="xs:anyURI"/> <!-- the URI of the class that constructors are attached to -->
541-
<xsl:variable name="control-groups" select="$form/descendant::div[contains-token(@class, 'control-group')]" as="element()*"/>
541+
<xsl:variable name="control-groups" select="$form/descendant::div[@property]" as="element()*"/>
542542

543543
<xsl:choose>
544544
<!-- input values missing, throw an error -->
@@ -554,7 +554,7 @@ exclude-result-prefixes="#all"
554554
<xsl:variable name="constructor-uri" select="@about" as="xs:anyURI"/>
555555
<xsl:variable name="construct-xml" as="document-node()">
556556
<!-- not all controls might have value, filter to those that have -->
557-
<xsl:iterate select="./div[contains-token(@class, 'control-group')][label//input[@name = 'ou']/@value][./div[contains-token(@class, 'controls')]//input[@name = 'ou']/@value or ./div[contains-token(@class, 'controls')]//select[@name = 'ou']]">
557+
<xsl:iterate select="./div[@property][label//input[@name = 'ou']/@value][./div[contains-token(@class, 'controls')]//input[@name = 'ou']/@value or ./div[contains-token(@class, 'controls')]//select[@name = 'ou']]">
558558
<xsl:param name="construct-xml" as="document-node()">
559559
<xsl:document>
560560
<json:map>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/form.xsl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ WHERE
872872
</xsl:result-document>
873873

874874
<!-- initialize the last property control group after it's appended -->
875-
<xsl:apply-templates select="(./div[contains-token(@class, 'control-group')][input/@name = 'pu'])[last()]" mode="ldh:RenderRowForm"/>
875+
<xsl:apply-templates select="(./div[@property][input/@name = 'pu'])[last()]" mode="ldh:RenderRowForm"/>
876876
</xsl:for-each>
877877

878878
<ixsl:set-style name="cursor" select="'default'" object="ixsl:page()//body"/>
@@ -882,7 +882,7 @@ WHERE
882882
<xsl:variable name="property-control-group" select="../.." as="element()"/>
883883
<xsl:variable name="fieldset" select="$property-control-group/.." as="element()"/>
884884
<xsl:variable name="property-uri" select="../preceding-sibling::*/select/option[ixsl:get(., 'selected') = true()]/ixsl:get(., 'value')" as="xs:anyURI"/>
885-
<xsl:variable name="forClass" select="ancestor::div[@typeof][contains-token(@class, 'row-fluid')]/@typeof" as="xs:anyURI*"/>
885+
<xsl:variable name="forClass" select="ancestor::*[@typeof][1]/@typeof" as="xs:anyURI*"/>
886886

887887
<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>
888888

@@ -1100,29 +1100,28 @@ WHERE
11001100
<xsl:sequence select="$context"/>
11011101
</xsl:function>
11021102

1103-
<!-- toggles the .control-group for subject URI/bnode ID editing -->
1103+
<!-- toggles the subject URI/bnode ID editing row -->
11041104
<xsl:template match="button[contains-token(@class, 'btn-edit-subj')]" mode="ixsl:onclick">
1105-
<!-- subject .control group is the first one after <legend> -->
1106-
<xsl:variable name="subj-control-group" select="ancestor::legend/following-sibling::div[1][contains-token(@class, 'control-group')]" as="element()"/>
1107-
1105+
<xsl:variable name="subj-control-group" select="ancestor::fieldset/div[@data-role = 'subject']" as="element()"/>
1106+
11081107
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'open' ])[current-date() lt xs:date('2000-01-01')]"/>
1109-
1108+
11101109
<xsl:for-each select="$subj-control-group">
11111110
<xsl:choose>
1112-
<xsl:when test="ixsl:style(.)?display = 'none'">
1113-
<ixsl:set-style name="display" select="'block'"/>
1111+
<xsl:when test="@hidden">
1112+
<ixsl:remove-attribute name="hidden"/>
11141113
</xsl:when>
11151114
<xsl:otherwise>
1116-
<ixsl:set-style name="display" select="'none'"/>
1115+
<ixsl:set-attribute name="hidden" select="'hidden'"/>
11171116
</xsl:otherwise>
11181117
</xsl:choose>
11191118
</xsl:for-each>
11201119
</xsl:template>
11211120

11221121
<!-- appends new SPIN-constructed instance to the page -->
1123-
<xsl:template match="div[contains-token(@class, 'row-fluid')]//button[contains-token(@class, 'add-constructor')][@data-for-class]" mode="ixsl:onclick" priority="1">
1122+
<xsl:template match="button[contains-token(@class, 'add-constructor')][@data-for-class][ancestor::*[@typeof][1]]" mode="ixsl:onclick" priority="1">
11241123
<xsl:param name="method" select="'post'" as="xs:string"/>
1125-
<xsl:param name="container" select="ancestor::div[contains-token(@class, 'row-fluid')][1]" as="element()"/>
1124+
<xsl:param name="container" select="ancestor::*[@typeof][1]" as="element()"/>
11261125
<xsl:sequence select="ixsl:call(ixsl:event(), 'preventDefault', [])[current-date() lt xs:date('2000-01-01')]"/>
11271126
<xsl:variable name="forClass" select="xs:anyURI(@data-for-class)" as="xs:anyURI"/>
11281127
<xsl:variable name="doc-uri" select="ac:absolute-path(ldh:base-uri(.))" as="xs:anyURI"/>
@@ -1382,7 +1381,7 @@ WHERE
13821381
<xsl:template match="ul[contains-token(@class, 'dropdown-menu')][contains-token(@class, 'type-typeahead')]/li" mode="ixsl:onmousedown" priority="1">
13831382
<xsl:param name="typeahead-class" select="'btn add-typeahead add-type-typeahead'" as="xs:string"/>
13841383
<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>
1385-
<xsl:variable name="container" select="ancestor::div[contains-token(@class, 'row-fluid')][1]" as="element()"/>
1384+
<xsl:variable name="container" select="ancestor::*[@typeof][1]" as="element()"/>
13861385
<xsl:variable name="fieldset" select="ancestor::fieldset" as="element()"/>
13871386
<xsl:variable name="doc-uri" select="ac:absolute-path(ldh:base-uri(.))" as="xs:anyURI"/>
13881387
<xsl:variable name="resource-id" select="input[@name = ('ou', 'ob')]/ixsl:get(., 'value')" as="xs:string"/> <!-- can be URI resource or blank node ID -->
@@ -1669,7 +1668,7 @@ WHERE
16691668
</xsl:when>
16701669
<!-- append new tooltip -->
16711670
<xsl:otherwise>
1672-
<xsl:variable name="description-span" select="ancestor::*[contains-token(@class, 'control-group')]//*[contains-token(@class, 'description')]" as="element()?"/>
1671+
<xsl:variable name="description-span" select="ancestor::*[@property]//*[contains-token(@class, 'description')]" as="element()?"/>
16731672
<xsl:if test="$description-span">
16741673
<xsl:variable name="input-offset-width" select="ixsl:get(., 'offsetWidth')" as="xs:integer"/>
16751674
<xsl:variable name="input-offset-height" select="ixsl:get(., 'offsetHeight')" as="xs:integer"/>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/modal.xsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ LIMIT 10
12221222
<xsl:template match="form[@id = 'form-clone-data'] | form[@id = 'form-generate-containers']" mode="ixsl:onsubmit" priority="1">
12231223
<xsl:param name="callback" as="function(map(*)) as item()*"/>
12241224
<xsl:sequence select="ixsl:call(ixsl:event(), 'preventDefault', [])"/>
1225-
<xsl:variable name="control-groups" select="descendant::div[contains-token(@class, 'control-group')]" as="element()*"/>
1225+
<xsl:variable name="control-groups" select="descendant::div[@property]" as="element()*"/>
12261226
<xsl:variable name="required-control-groups" select="$control-groups[contains-token(@class, 'required')]" as="element()*"/>
12271227

12281228
<!-- clear the errors initially -->
@@ -1283,12 +1283,12 @@ LIMIT 10
12831283
<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>
12841284

12851285
<xsl:variable name="fieldset" select="ancestor::form/fieldset" as="element()"/>
1286-
<xsl:variable name="control-groups" select="descendant::div[contains-token(@class, 'control-group')]" as="element()*"/>
1286+
<xsl:variable name="control-groups" select="descendant::div[@property]" as="element()*"/>
12871287
<xsl:variable name="required-control-groups" select="$control-groups[contains-token(@class, 'required')]" as="element()*"/>
12881288
<xsl:variable name="timeout" select="30000" as="xs:integer"/> <!-- schema load query timeout in milliseconds -->
1289-
<xsl:variable name="service-control-group" select="$fieldset/descendant::div[contains-token(@class, 'control-group')][input[@name = 'pu'][@value = '&ldh;service']]" as="element()"/>
1289+
<xsl:variable name="service-control-group" select="$fieldset/descendant::div[@property = '&ldh;service']" as="element()"/>
12901290
<xsl:variable name="service-uri" select="$service-control-group/descendant::input[@name = 'ou']/ixsl:get(., 'value')" as="xs:anyURI?"/>
1291-
<xsl:variable name="limit-control-group" select="$fieldset/descendant::div[contains-token(@class, 'control-group')][input[@name = 'pu'][@value = '&sp;limit']]" as="element()"/>
1291+
<xsl:variable name="limit-control-group" select="$fieldset/descendant::div[@property = '&sp;limit']" as="element()"/>
12921292
<xsl:variable name="limit-string" select="$limit-control-group/descendant::input[@name = 'ol']/ixsl:get(., 'value')" as="xs:string"/>
12931293
<xsl:variable name="limit" select="xs:integer($limit-string)" as="xs:integer"/>
12941294
<xsl:variable name="select-string" select="$endpoint-classes-string" as="xs:string"/>
@@ -1719,7 +1719,7 @@ LIMIT 10
17191719
<xsl:choose>
17201720
<!-- Success: redirect to parent container with refresh -->
17211721
<xsl:when test="$status = (200, 201, 204)">
1722-
<xsl:variable name="control-group" select="$form/descendant::div[contains-token(@class, 'control-group')][input[@name = 'pu'][@value = '&sioc;has_parent']]" as="element()*"/>
1722+
<xsl:variable name="control-group" select="$form/descendant::div[@property = '&sioc;has_parent']" as="element()*"/>
17231723
<xsl:variable name="uri" select="$control-group/descendant::input[@name = 'ou']/ixsl:get(., 'value')" as="xs:anyURI"/>
17241724
<!-- Remove the modal -->
17251725
<xsl:sequence select="ixsl:call($form/ancestor::div[contains-token(@class, 'modal')], 'remove', [])[current-date() lt xs:date('2000-01-01')]"/>
@@ -1747,7 +1747,7 @@ LIMIT 10
17471747
<xsl:choose>
17481748
<!-- Success: redirect to target container with ReadMode -->
17491749
<xsl:when test="$status = (200, 204)">
1750-
<xsl:variable name="control-group" select="$form/descendant::div[contains-token(@class, 'control-group')][input[@name = 'pu'][@value = '&sd;name']]" as="element()*"/>
1750+
<xsl:variable name="control-group" select="$form/descendant::div[@property = '&sd;name']" as="element()*"/>
17511751
<xsl:variable name="uri" select="$control-group/descendant::input[@name = 'ou']/ixsl:get(., 'value')" as="xs:anyURI"/>
17521752
<!-- Remove the modal -->
17531753
<xsl:sequence select="ixsl:call($form/ancestor::div[contains-token(@class, 'modal')], 'remove', [])[current-date() lt xs:date('2000-01-01')]"/>

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -620,18 +620,26 @@ exclude-result-prefixes="#all"
620620
<xsl:template match="text()[../@xml:lang]" mode="xhtml:DefinitionDescription">
621621
<xsl:variable name="property-uri" select="../concat(namespace-uri(), local-name())" as="xs:string"/>
622622

623-
<dd property="{$property-uri}">
623+
<dd property="{$property-uri}" xml:lang="{../@xml:lang}">
624624
<span class="label label-info pull-right">
625625
<xsl:value-of select="../@xml:lang"/>
626626
</span>
627627

628628
<xsl:apply-templates select="."/>
629629
</dd>
630630
</xsl:template>
631-
631+
632+
<xsl:template match="text()[../@rdf:datatype]" mode="xhtml:DefinitionDescription">
633+
<xsl:variable name="property-uri" select="../concat(namespace-uri(), local-name())" as="xs:string"/>
634+
635+
<dd property="{$property-uri}" datatype="{../@rdf:datatype}">
636+
<xsl:apply-templates select="."/>
637+
</dd>
638+
</xsl:template>
639+
632640
<xsl:template match="node()" mode="xhtml:DefinitionDescription">
633641
<xsl:variable name="property-uri" select="../concat(namespace-uri(), local-name())" as="xs:string"/>
634-
642+
635643
<dd property="{$property-uri}">
636644
<xsl:apply-templates select="."/>
637645
</dd>
@@ -782,11 +790,11 @@ exclude-result-prefixes="#all"
782790
<!-- cut slug segment from form action URL -->
783791
<xsl:param name="slug" select="substring-before(substring-after($action, ac:absolute-path(ldh:base-uri(.))), '/')" as="xs:string"/>
784792

785-
<div class="control-group">
793+
<div class="control-group" data-role="subject">
786794
<xsl:if test="$type = 'hidden'">
787-
<xsl:attribute name="style" select="'display: none'"/>
795+
<xsl:attribute name="hidden" select="'hidden'"/>
788796
</xsl:if>
789-
797+
790798
<span class="control-label">
791799
<select class="subject-type input-medium" disabled="disabled">
792800
<option value="su" selected="selected">URI</option>
@@ -825,11 +833,11 @@ exclude-result-prefixes="#all"
825833
<xsl:param name="document-uri" as="xs:anyURI?" tunnel="yes"/>
826834
<xsl:param name="about" select="xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#id' || ac:uuid())" as="xs:anyURI?"/>
827835

828-
<div class="control-group">
836+
<div class="control-group" data-role="subject">
829837
<xsl:if test="$type = 'hidden'">
830-
<xsl:attribute name="style" select="'display: none'"/>
838+
<xsl:attribute name="hidden" select="'hidden'"/>
831839
</xsl:if>
832-
840+
833841
<span class="control-label">
834842
<input type="hidden" class="old subject-type" value="{if (local-name() = 'about') then 'su' else if (local-name() = 'nodeID') then 'sb' else ()}"/>
835843
<select class="subject-type input-medium">
@@ -903,6 +911,7 @@ exclude-result-prefixes="#all"
903911
<xsl:if test="$class">
904912
<xsl:attribute name="class" select="$class"/>
905913
</xsl:if>
914+
<xsl:attribute name="property" select="$this"/>
906915

907916
<xsl:apply-templates select="." mode="xhtml:Input">
908917
<xsl:with-param name="type" select="'hidden'"/>

0 commit comments

Comments
 (0)