|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Copy element with attributes
Hi all,
I have the following problem: I have an xhtml file that I want to transform using xslt, like the one below. I want to prepend and append some text and change some body tag attributes but copy any other attributes. I cannot seem to get that done in the same transformation. An example: <html> <head> </head> <body text="#003366" bgcolor="#663300" onload="otherAttribs()"> <p>My page</p> </body> </html> The result should be: <html> <head> </head> <body text="#000000" bgcolor="#ffffff" onload="otherAttribs()"> Prepend text <p>My page</p> Append text </body> </html> The xslt I use: <xsl:template match="body"> <xsl:copy> Prepend text <xsl:apply-templates/> Append text </xsl:copy> </xsl:template> removes body tag attributes. How can I copy the body tag attributes at the same time, so I can use something like: <xsl:template match="body/@text"> <xsl:attribute name="text">#000000</xsl:attribute> </xsl:template> to change attributes. Thanks, Diogo _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
|
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








