Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

¿how copy nodes and attributes with copy-of?

Status
Not open for further replies.

visualedu

Programmer
Sep 7, 2001
3
ES
hi, I have a problem, I've got a xml file that contains HTML TAGS. I want show this data like HTML without any XML filter. I'm using tag copy:

<xsl:template match=&quot; //show//* | //show//text()&quot;>
<xsl:copy >
<xsl:apply-templates />
</xsl:copy>
</xsl:template>

But attributes aren't copied, I've tried use TAG copy-of but I can't do it:

<xsl:template match=&quot; //show//* | //show//text()&quot;>
<xsl:copy-of >
<xsl:apply-templates />
</xsl:copy>
</xsl:template>

Do you know how to do it? thaks for your support

 
visualedu,

what type of data or text will the html page have on it?

aaron

 
aaron,
all text and tags that XHTML allowes
thanks.

 
<xsl:template match=&quot;/&quot;>
<xsl:copy-of select=&quot;.&quot;/>
</xsl:template>

the above would just copy the whole input file to the output - ie. it copies all of the children too.

i can't really work out what your input xml looks like but i think your template match might be overly complicated.

<xsl:template match=&quot;show&quot;>
<xsl:copy-of select=&quot;./*&quot;/>
</xsl:template>

the above may not work, cos i'm just guessing your xml structure.
 
I've already tried that:

<xsl:template match=&quot;show&quot;>
<xsl:copy-of select=&quot;./*&quot;/>
</xsl:template>

but the system gives me the following message

&quot;the key word xsl:copy-of can't be used here&quot;.

I don't know why???

(Thanks MrTom)
 
hmmm... what xsl processor are you using?

if it's IE make sure you've got the latest MS xsl stuff.

either that, or there might be a problem elsewhere in the xsl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top