Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Selectively applying Identity transform to multiple inputs (Multiplexer Style Sheet)

From: "Michael Kay" <mike@------------>
To:
Date: 1/5/2007 9:33:00 PM
Something like this:

<xsl:template match="/">
  <xsl:choose>
    <xsl:when test="$input2 != ''">
      <xsl:apply-templates select="document($input2)/child::node()"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="./child::node()"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Or replace the xsl:apply-templates by xsl:copy-of if it really is a pure
copy.

In 2.0 you can do

<xsl:template match="/">
  <xsl:apply-templates 
    select="(if ($input2='') then document($input2) else .)/child::node()"/>
</xsl:template>

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Farrukh S. Najmi [mailto:farrukh@xxxxxxxxxxxxxxxxxxxxx] 
> Sent: 05 January 2007 20:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Selectively applying Identity transform to 
> multiple inputs (Multiplexer Style Sheet)
> 
> 
> 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.
> 
> --
> Regards,
> Farrukh
> 
> Web: http://www.wellfleetsoftware.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent