|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: suprised by <xsl:copy-of select="@*"/>
> I was suprised that this template: > > <xsl:template match="cell"> > <td> > <xsl:copy-of select="@*"/> > <xsl:apply-templates/> > </td> > </xsl:template> > > against this XML: > > <cell colspan="2" bgcolor="#CC0000"> > some other stuff... > </cell> > > produced this output: > > <td colspan="2" bgcolor="#CC0000"> > result of transform on other stuff... > </td> > > Why did I get > <td colspan="2" bgcolor="#CC0000"> > instead of > <td>colspan="2" bgcolor="#CC0000" Basically, because <xsl:copy-of seelct="@*"/> creates attribute nodes onthe result tree, and your the output [<td>colspan="2" bgcolor="#CC0000"] could never be produced by serializing attribute nodes. <td>.....</td>, after parsing, becomes an element node on the stylesheet tree. This element node acts as a special kind of instruction, called a literal result element. When a literal result element is "instantiated" (i.e. executed) it creates an element node on the result tree, and then instantiates the instructions that are children of the literal result element in the stylesheet tree. The first such instruction is <xsl:copy-of>, and this creates attribute nodes which are added to the "current" element node on the result tree. I spelt this out laboriously, because I suspect you aren't really thinking of the process in terms of nodes on trees, but this is essential to understanding the behavior. Mike Kay Software AG XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








