This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Identity Transform and Default Templates, I think...
- From: "J.Pietschmann" <j3322ptm at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 18 Jun 2002 22:34:06 +0200
- Subject: Re: [xsl] Identity Transform and Default Templates, I think...
- References: <A38C0F5A6E195C48AC2C93BEC33EF83D628BDB@sw745x043.visa.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Schneeman, Brent wrote:
That sheet works fine (using Xalan2-J). But now I'd like to make it a bit
more flexible. I want to be able to identically copy elements which are not
matched by any explicit template.
Try adding the canonical copy-through template
<xsl:template select="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
BTW:
<xsl:template match="BD">
<!-- output Body element -->
<Body>
<!-- grab the id attribute -->
<xsl:attribute name="id">
<xsl:value-of select="attribute::id"/>
</xsl:attribute>
You can write this as
<xsl:template match="BD">
<!-- output Body element -->
<Body id="{@id}">
(Look up "attribute value template" and shorthands
for XPath axes)
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list