XSLTOperation and sourceLocation
Posted: Tue Oct 18, 2022 12:03 am
I have created an XSLTOperation action that wraps the content of a table <entry> in a <styled-content> element, using this XSLT stylesheet:
This works as expected when I place the cursor in the table cell but not inside any child element of the cell. However, for ease of use, I'd like to be able to place the cursor anywhere inside the table cell. For example, if the cell looks like this--
--I'd like to be able to be able to place the cursor inside the italic phrase. I tried to enable this by setting the sourceLocation parameter to 'ancestor-or-self::entry', but that doesn't work. Is there a way to do this?
Code: Select all
<xsl:stylesheet
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:oxy="http://www.oxygenxml.com/ns/author/xpath-extension-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs oxy" version="2.0">
<xsl:template match="/">
<xsl:apply-templates select="oxy:current-element()"/>
</xsl:template>
<xsl:template match="entry">
<xsl:copy copy-namespaces="no">
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:element name="styled-content">
<xsl:attribute name="specific-use" select="string('row-header')"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:copy>
</xsl:template>
<!-- catchall -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<entry><italic>Passer domesticus</italic></entry>