InsertFragmentOperation from css button
Posted: Sun Jan 29, 2017 8:23 am
Hi All,
I'm having trouble with inserting a fragment into the correct location using oxy_action inside oxy_button from the content property of a css style. I can't get the fragment to be inserted in the desired location and it instead goes into a location that makes no sense to me. My document and style look approximately like below. I want to have a button that adds new <socm> element after the one already in the index so that it becomes the last child of the wrapping <seeie> element. The document is valid against a modified docbook relaxng schema. I can get the button to appear where I want: after the <socm> element that is the last-child of the <seeie> element, but I don't get the expected insert results from my arg-insertLocation and arg-insertPosition arguments, of '.' and 'After', respectively. Instead of going in where I want it, the <socm> element goes in after the </index> tag. I can't make sense of this from any interpretation of where my current node may be. I have tried insert my cursor in all sorts of specific locations and watching the path of my location but that doesn't make a difference, which raises the question of what controls my current node location when I click the button? I am thinking it is the location of the button.
I get a very similar pattern in other places where I have put similar buttons e.g. adding <para>s in articles go in after the </article> tag not after the current <para>. Some combos of arg-insertLocation and arg-insertPosition work the way that makes sense to me, e.g., "." and 'Inside as last child' or 'Inside as first child' put the new <socm> inside the current <socm>. I want it after the current <socm> inside the current <seeie>.
Funny thing is that I thought I had a slightly different version of this working properly before, but perhaps I was seeing things. I've tried every alternative and workaround I can think of this time around.
Thanks, Doug
Here's my approximate document:
And here is my style (I've tested that this style is being referenced by the <socm> element above :
I'm having trouble with inserting a fragment into the correct location using oxy_action inside oxy_button from the content property of a css style. I can't get the fragment to be inserted in the desired location and it instead goes into a location that makes no sense to me. My document and style look approximately like below. I want to have a button that adds new <socm> element after the one already in the index so that it becomes the last child of the wrapping <seeie> element. The document is valid against a modified docbook relaxng schema. I can get the button to appear where I want: after the <socm> element that is the last-child of the <seeie> element, but I don't get the expected insert results from my arg-insertLocation and arg-insertPosition arguments, of '.' and 'After', respectively. Instead of going in where I want it, the <socm> element goes in after the </index> tag. I can't make sense of this from any interpretation of where my current node may be. I have tried insert my cursor in all sorts of specific locations and watching the path of my location but that doesn't make a difference, which raises the question of what controls my current node location when I click the button? I am thinking it is the location of the button.
I get a very similar pattern in other places where I have put similar buttons e.g. adding <para>s in articles go in after the </article> tag not after the current <para>. Some combos of arg-insertLocation and arg-insertPosition work the way that makes sense to me, e.g., "." and 'Inside as last child' or 'Inside as first child' put the new <socm> inside the current <socm>. I want it after the current <socm> inside the current <seeie>.
Funny thing is that I thought I had a slightly different version of this working properly before, but perhaps I was seeing things. I've tried every alternative and workaround I can think of this time around.
Thanks, Doug
Here's my approximate document:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook">
<title>Book<title>
<article>
<title>Article</title>
<para>Blah blah</para>
</article>
<index hrafid="a000-000-index" ocms="104">
<title>INDEXING NOTES </title>
<indexentry>
<primaryie>
<glossterm/>
<modifier/>
<termdef/>
</primaryie>
<seeie>
<termdef/>
<socm code="101"/><!-- Button appears here at the :after pseudo element of the <socm> -->
</seeie>
<!-- I want to insert an new <socm> element here-->
</indexentry>
</index>
<!-- Instead the new <socm> element goes here -->
<bibliography>
<bibliomixed>
Blah blah
</bibliomixed>
</bibliography>
</book>
Code: Select all
seeie>socm:last-child::after {
display: block;
content: oxy_button(color, 'blue',
action, oxy_action(
name, '+',
description, 'Add an OCM to this set',
icon, url('insert.png'),
operation, InsertFragmentOperation,
arg-fragment, '<socm xmlns="http://docbook.org/ns/docbook" code="000"/>',
arg-insertLocation, '.',
arg-insertPosition, 'After'
));
}