|
Subject: Re: [xsl] Identity transform on node-set loaded with document() From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Thu, 02 Aug 2007 11:19:22 +0200 |
Hi,
I've been away from XSLT a while and am stumbling on how to implement the following:
My transform imports, using document(), an HTML snippet contain a populated <head></head> tag. I want to copy this into one of several result trees I am outputting as is *except* the <title/> tag needs to be populated with a value.
Initially I created a named template and sent the loaded node-set to it, then realised I probably needed an identity transform but all of the identity transform examples I've found seem to be set-up to operate on the master document only. What's the best way to carry out this task? Can I do an identity transform with a named template?
I'm sure there's a fairly simple solution but it's passing me by.
<xsl:template match="/">
<xsl:apply-templates select="document('xyz')" mode="newtitle" />
<xsl:apply-templates select="*" />
</xsl:template><xsl:template match="node() | @*" mode="#all" >
<xsl:copy>
<xsl:apply-templates select="node() | @*" mode="#current" />
</xsl:copy>
</xsl:template><xsl:template match="title" mode="newtitle">
<title>a new title</title>
</xsl:template>Cheers, -- Abel Braaksma
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Identity transform on nod, Michael Kay | Thread | [xsl] WYSIWYG XSLT Web based editor, Senthilkumaravelan K |
| RE: [xsl] XML with Default Namespac, Michael Kay | Date | Re: [xsl] WYSIWYG XSLT Web based ed, Abel Braaksma |
| Month |