XSLT extension elements: self_node evaluated only sometimes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
New
|
Undecided
|
Unassigned |
Bug Description
Hi, I am following this example: https:/
<foo><my:
with this line:
<foo><my:
that is, I get in the output:
<foo>I did it!<child>
which is great.
However, if instead I do:
<foo><my:
then the output becomes:
<foo>I did it!<child xmlns:xsl="http://
which is not what I want because I want this to be evaluated.
This means the XSLT inside the extension element gets evaluated _sometimes_. xsl:text gets evaluated but xsl:value-of does not.
Here your original code from the documentation, in one piece:
import lxml.etree as etree
class MyExtElement(
def execute(self, context, self_node, input_node, output_parent):
# just copy own content input to output
# output_
xslt_ext_tree = etree.XML('''
<xsl:stylesheet version="1.0"
xmlns:xsl="http://
xmlns:
extension-
<xsl:template match="/">
</
<xsl:template match="child">
</
</xsl:
my_extension = MyExtElement()
extensions = { ('testns', 'ext') : my_extension }
transform = etree.XSLT(
root = etree.XML(
result = transform(root)
print(str(result))
Here my config:
Python : sys.version_
lxml.etree : (4, 6, 3, 0)
libxml used : (2, 9, 10)
libxml compiled : (2, 9, 10)
libxslt used : (1, 1, 34)
libxslt compiled : (1, 1, 34)
Thanks!