[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] changing only one attribute of element copy
Hello,
It would be nice if someone could tell me the easiest way of changing just one (and keeping the other) attributes of an copied element. I am using the following templates to copy elements from a source class to a target class: <xsl:template match="node() | @*" mode="transform"> <xsl:copy> <xsl:apply-templates select="node() | @*" mode="transform"/> </xsl:copy> </xsl:template> <xsl:template match="//class[@name=$TargetCName]" mode="transform"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:copy-of select="//class[@name=$SrcCName]/field"> <xsl:apply-templates mode="transform"/> </xsl:copy> </xsl:template> Inside "class" are elements like <field id="31" class="3" type="type(basic,int,0)" name="publ_int_j" init="null"/> which are going to be copied. What, if I want to change the "id" of the copied element? (Suppose, I don't know that the element name is "field") Do I have to create a completely new element using <xsl:element> and to write down every single attribute explicitely using <xsl:attribute>? Or is there a possibility to copy the old attributes und to create just one new attribute? My problem is, that <xsl:copy-of> doesn't allow <xsl:attribute> inside and <xsl:copy> which allows it doesn't allow a "select" inside... Regards, Garvin
|
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
|