visual studio 2008 - XSLT Duplicate Templates with Includes -


i'm having problem including xslt templates.

i have a.xslt includes b.xslt , c.xslt.

b , c both require template located in d.xslt. if add include statement in b , c, duplicate template error in vs2008:

the named template 'mytemplate' not exist.  

and when try hit web page uses these xslts error , don't display correctly.

if include d.xslt in a.xslt display correctly, error in b , c stating template i'm referencing doesn't exist:

'mytemplate' duplicate template name.   

what correct way have kind of include tree? or maybe it's vs2008 problem?

i eliminate d.xslt , add template both b , c, it's easier manage if template in 1 place.

  • edited: added actual vs2008 error text.

using xsl:include same pasting them in 1 giant file, give same duplicate template errors.

use xsl:import instead of xsl:include.
overlay/merge of templates give super-set. last template in import chain "win" instead of giving duplicate definition error, have higher precedence.

  • have a.xslt xsl:import b.xslt , c.xslt.
  • have b.xslt , c.xslt xsl:include or xsl:import d.xslt.

personally, tend use xsl:import on xsl:include.

the real downside of xsl:import might accidentally override template further down in import chain , not know it(because won't same compilation error xsl:include). there might slight performance hit, since xslt processor has "think" little more import chain, haven't found problem.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -