Subject: Re: [xsl] Selectively applying Identity transform to multiple inputs (Multiplexer Style Sheet) From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Fri, 05 Jan 2007 22:20:21 +0100 |
<!-- without modes, in XSLT 1 just a copy --> <xsl:template match="/"> <xsl:choose> <xsl:when test="$input2 != '' "> <xsl:copy-of select="document($input2)/*" /> </xsl:when> <xsl:otherwise> <xsl:copy-of select="." /> </xsl:otherwise> </xsl:choose> </xsl:template>
<!-- XSLT 1: internal document handling --> <xsl:template match="node() | @*" mode="internal"> <xsl:apply-templates select="node() | @*" mode="internal" /> </xsl:template>
<!-- XSLT 1: external (from $input2) document handling --> <xsl:template match="node() | @*" mode="external"> <xsl:apply-templates select="node() | @*" mode="external" /> </xsl:template>
<xsl:template match="node() | @*" mode="internal external"> <xsl:apply-templates select="node() | @*" mode="#current" /> </xsl:template>
<!-- both XSLT 1 and 2: use normal templates for overriding. in XSLT 1: use one template per mode in XSLT 2: if overlap, you can use both modes in one template, or #all -->
Cheers, -- Abel Braaksma http://www.nuntia.nl
Dear colleagues,
I have a newbie question.
In my XSLT, in addition to my main input, I am reading a second input in my XSLT using the document() function. The second input's URL is specified via an <xsl:param>:
<xsl:param name="input2" select="''"></xsl:param>
I need to produce output tree that is either the identity transform of the main input or the second input depending upon whether the parameter $input2 is null/empty or not. If it is null/empty then the main input should be copied to output tree. If it is not null/empty then the second input should be copied to output tree.
I have been unable to do this correctly after much trying.
Can someone provide some guidance on how to accomplish this seemingly simple task?
Thanks for your help.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Selectively applying Iden, Farrukh S. Najmi | Thread | Re: [xsl] Selectively applying Iden, Abel Braaksma |
Re: [xsl] Selectively applying Iden, Farrukh S. Najmi | Date | RE: Re: [xsl] Selectively applying , cknell |
Month |