Re: [lxml] no xpath evaluation in attributes of xslt extension elements?
Well, maybe. Unfortunately, I can't test it in my application because of a second problem. Ultimately, I would like to create an extension element that performs an XPath query on another document and inserts the result of the query into the output of the transformation. However, XPath query results come back as different types from what output_parent.append() expects, so simply passing the query result to the transformation result breaks the script. The documentation suggests that read-only types can be made into regular types by calling deepcopy(), but in my case this has no effect. Is there a solution to this new problem? ----- Original Message ----- Date: Thu, 01 Nov 2012 14:24:43 +0100 From: Stefan Behnel <stefan_ml@behnel.de> Subject: [lxml] no xpath evaluation in attributes of xslt extension elements? To: lxml mailing list <lxml@lxml.de> Eric Levy, 29.10.2012 08:31:
I'm back with another question about lxml.
I am tinkering with the extension elements feature of the XSLT engine.
I notice that if I try to give an XPath expression enclosed in {} as an attribute value in my own element type, the contents of the {} are not evaluated as an XPath expression, even though they would be if the element were not an extension.
For example, in normal XSLT processing:
<xslt:apply-templates match="foo"> <bar attrib-of-bar="{@attrib-of-foo}" /> </xslt:apply-templates>
This would create a <bar/> element with the attrib-of-bar attribute set to the value of the attrib-of-foo attribute of foo.
However, if <bar/> is lxml extension element, then the {} contents are not evaluated, but rather the entire attribute value is returned verbatim.
Does this help? http://lxml.de/extensions.html#applying-xsl-templates Stefan
participants (1)
-
Eric Levy