f



XSLT: getting text of a node into an attribute

I have a document, lets say:

<Doc>
    <Ele1 Att1='hello'>
        <Ele2 Att2='goodbye'/>
    </Ele1>
</Doc>

In XSLT I need to generate an attribute value which contains part of
this document as a text string, ie:

<MyOutput XML="&lt;Ele1 Att1='hello'>
        &lt;Ele2 Att2='goodbye'/>
    &lt;/Ele1>"/>


I can output it easily enough at child elements (copy-of), or as a
CDATA string in the element content, but I cannot find any way to get
it into an attribute.

What should I be doing?
0
7/31/2003 1:34:53 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

1 Replies
470 Views

Similar Articles

[PageSpeed] 20

use

<xsl:attribute name="XML">
    <xsl:copy-of ...> (or whatever)
</xsl:attribute>

anything you put inside here will be put into the XML attribute of the node
you're creating

"Kevin" <kevinburges@formedix.com> wrote in message
news:1bf2fce.0307310534.516abff@posting.google.com...
> I have a document, lets say:
>
> <Doc>
>     <Ele1 Att1='hello'>
>         <Ele2 Att2='goodbye'/>
>     </Ele1>
> </Doc>
>
> In XSLT I need to generate an attribute value which contains part of
> this document as a text string, ie:
>
> <MyOutput XML="&lt;Ele1 Att1='hello'>
>         &lt;Ele2 Att2='goodbye'/>
>     &lt;/Ele1>"/>
>
>
> I can output it easily enough at child elements (copy-of), or as a
> CDATA string in the element content, but I cannot find any way to get
> it into an attribute.
>
> What should I be doing?


0
ajfish (411)
7/31/2003 2:17:10 PM
Reply: