Replace tags while keeping text

frodos_pants
Posts: 4
Joined: Fri Jan 13, 2017 7:35 pm

Replace tags while keeping text

Post by frodos_pants »

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: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Replace tags while keeping text

Post by Radu »

Hi Tom,

The XSLTOperation should be documented here:
https://www.oxygenxml.com/doc/versions/ ... tions.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
Post Reply