Xsl link to external xsl file

I have a question about xsl. I have 1 huge xsl file (+4000 lines: p) and I would like to split the file in different parts. I use the xsl file to map some schemas in BizTalk, and it would be more efficient if I split it in parts, so I can reuse the details. Anyway, ignore the BizTalk stuff, how can I link to my main xsl file in different parts?

eg:.

    <?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>

Therefore, I would like to put "EVN_EventType" and "PID_PatientIdentification" in another file. Maybe this xsl is not 100% valid, I am copying / pasting something quickly, but you get my point?

I really appreciate any help. thank

+3
2

<xsl:import> , . :

  • EVN_EventType, EVN_EventType.xsl
  • PID_PatientIdentification, PID_PatientIdentification.xsl;
  • <xsl:template match="/ns1:ADT_A01_231_GLO_DEF"> .
+4

Source: https://habr.com/ru/post/1768484/


All Articles