Re: [xsl] Copying unknown attributes in XML to XML transformation?

Subject: Re: [xsl] Copying unknown attributes in XML to XML transformation?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 24 Jan 2001 13:31:13 GMT
 
] Try this, Bill:
] 
] <xsl:template match="connectionFactory">
]   <xsl:element name="connectionFactory">
]     <xsl:for-each select="@*">
]       <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
]     </xsl:for-each>
]    <xsl:attribute name="host"><xsl:value-of select="$host"/></xsl:attribute>
]    <xsl:attribute name="port"><xsl:value-of select="$port"/></xsl:attribute>
]   </xsl:element>
] </xsl:template>



That works, but it is equivalent to the rather shorter


<xsl:template match="connectionFactory">
  <connectionFactory host="{$host}" port="{$port}">
  <xsl:copy-of select="@*"/>
 </connectionFactory>
</xsl:template>

David

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread