xslt - xsl reference to external xsl file -


i have question xsl. have 1 huge xsl file (+4000 lines :p) , split file in different parts. use xsl file map schemas in biztalk , more performant if split in parts, can re-use parts. anyway, don't mind biztalk stuff, how can reference main xsl file different parts?

ex.:

    <?xml version="1.0" encoding="utf-16"?>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform">       <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />       <xsl:template match="/">         <xsl:apply-templates select="/ns1:adt_a01_231_glo_def" />       </xsl:template>       <xsl:template match="/ns1:adt_a01_231_glo_def">         <ns1:adt_a01_25_glo_def>           <evn_eventtype>                 <xsl:if test="evn_eventtypesegment/evn_1_eventtypecode">                   <evn_1_eventtypecode>                     <xsl:value-of select="evn_eventtypesegment/evn_1_eventtypecode/text()" />                   </evn_1_eventtypecode>                 </xsl:if>                 <evn_2_recordeddatetime>                   <xsl:if test="evn_eventtypesegment/evn_2_recordeddatetime/ts_0_timeofanevent">                     <ts_0_time>                       <xsl:value-of select="evn_eventtypesegment/evn_2_recordeddatetime/ts_0_timeofanevent/text()" />                     </ts_0_time>                   </xsl:if>                   <xsl:if test="evn_eventtypesegment/evn_2_recordeddatetime/ts_1_degreeofprecision">                     <ts_1_degreeofprecision>                       <xsl:value-of select="evn_eventtypesegment/evn_2_recordeddatetime/ts_1_degreeofprecision/text()" />                     </ts_1_degreeofprecision>                   </xsl:if>                 </evn_2_recordeddatetime>           </evn_eventtype>           <pid_patientidentification>             <xsl:if test="pid_patientidentificationsegment/pid_1_setidpid">               <pid_1_setidpid>                 <xsl:value-of select="pid_patientidentificationsegment/pid_1_setidpid/text()" />               </pid_1_setidpid>             </xsl:if>            </pid_patientidentification>         </ns1:adt_a01_25_glo_def>       </xsl:template>     </xsl:stylesheet> 

so put "evn_eventtype" , "pid_patientidentification" in file. xsl isnt 100% valid, copy/pasted something, point?

greatly appreciate help. thx

use <xsl:import> @ top level of stylesheet, import templates other stylesheets. can:

  • create named template evn_eventtype, put in evn_eventtype.xsl
  • create named template pid_patientidentification, put in pid_patientidentification.xsl;
  • then import both stylesheets main stylesheet
  • and call both templates within <xsl:template match="/ns1:adt_a01_231_glo_def"> above.

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -