|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: getting "Cannot create an attribute node (...) who
On Tue, Jun 30, 2020 at 04:10:23PM -0000, Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx scripsit:
> Hello! Language is XSLT 2.0, processor is Saxon-PE 9.9.1.7 in Oxygen XML Editor v22.1.
>
> I'm trying to pass attribute nodes from an element template to a function, make a modified copy of the attributes inside the function, then return them for inclusion in the element. But when I attempt this, I get
>
> Cannot create an attribute node (class) whose parent is a document node.
You put the attributes in a variable:
<xsl:variable name="new_atts">
<xsl:sequence select="$orig_atts"/>
</xsl:variable>
By default, any untyped variable will be created as a document node.
You avoid that by using "as" to specify a type, specifically that this
variable is a sequence of one or more attributes:
<xsl:variable name="new_atts" as="attribute()+">
<xsl:sequence select="$orig_atts"/>
</xsl:variable>
(Possibly zero or more, which would make it "attribute()*".
--
Graydon Saunders | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








