Replace tags while keeping text

frodos_pants
Posts: 4

Replace tags while keeping text

Tue May 02, 2017 4:50 am

Hi,

I have an authoring template which has some questions. Most of the questions are just regular questions.

<li class="question">
<p>Question text</p>
</li>

Some are going to have a downloadable file.

<li class="question">
<p>Question text</p>
<div class="download">
<a href="" class="ulink">Download this File</a>
</div>
</li>

I want to add a button to this so if the question has a downloadable file they can click a button to update the tagging. The button's no problem, but what's the best way to transform/change this? The question text will already exist when the decision is made regarding the downloadable file, so the button needs to change the tagging, and leave the text. I tried to use "ro.sync.ecss.extensions.commons.operations.XSLTOperation", but I can't find anything that shows examples of what to put in the available fields. Do you know where I could locate that? I'm not sure what to put into sourceLocation or targetLocation for example.

Thanks,
Tom
Radu
Posts: 5097

Re: Replace tags while keeping text

Tue May 02, 2017 8:13 am

Hi Tom,

The XSLTOperation should be documented here:
https://www.oxygenxml.com/doc/versions/19.0/ug-editor/topics/dg-default-author-operations.html

in your case if the button is added by the CSS selectors on the <li> element then the sourceLocation needs to remain unassigned (as the source is the current element). The targetLocation again must remain with the default value because you want to replace the current element. The XSLT script will receive as content the current <li> on which the button is placed and needs to process it. You can use xsl:message's in the XSLT script to debug your progress.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “XHTML”

Who is online

Users browsing this forum: No registered users and 0 guests