0

Hi is it possible to assign an include file based on the value of a node in XSLT like:

<BankName>HSBC</BankName>
<xsl:include href="HSBC.xsl" />

<BankName>DB</BankName>
<xsl:include href="DB.xsl" />

<BankName>SCB</BankName>
<xsl:include href="SCB.xsl" />
zyberjock
  • 337
  • 5
  • 19
  • Don't you mean based on the value in XML node, rather than a node in XSLT? Have a look a this thread http://stackoverflow.com/questions/8991239/xslt-conditional-include-of-external-file – Dijkgraaf Aug 27 '13 at 03:10

1 Answers1

0

No. Like most languages, XSLT has a static (compile-time) phase and a dynamic (run-time) phase. xsl:include is processed at compile time, long before any nodes are seen. Until you've processed the xsl:include directives, you don't know what program you are running, so you have no idea what to do with the input anyway.

If you explain what you are trying to achieve, then I'm sure we can suggest a way of achieving it in XSLT.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164