代码之家  ›  专栏  ›  技术社区  ›  jbrehr

从外部文档复制XSLT

  •  0
  • jbrehr  · 技术社区  · 6 年前

    在XSLT 2.0中,我正在转换 tei-xml 将文档转换为HTML。在这种转换中,我需要来自另一个文档的内容:我想将第二个文档中的一小组节点复制/转换为HTML输出。

    tei 文档I获取id并将其分配给变量:

    <xsl:variable name="licenseid" select="./replace(@corresp,'#','')"/>
    

    然后我转到另一个文档,使用变量获取节点,并将返回的节点分配给一个变量:

    <xsl:variable name="licenseloc" select="doc(concat($somepath,'includes_sourcedesc.xml'))//tei:list[@type='copyright_type']/tei:item[@xml:id=$licenseid]"/>
    

    我获得的节点如下所示:

    <list type="copyright_type">
      <item xml:id="copyright-cc-by-nc-sa-4.0">
         <desc xml:lang="en">This work is made by available the author under the 
         <ref target="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 
            4.0 International License</ref>.</desc>
      </item>
    </list>
    

    我想把它(从 desc )对此:

    <span>This work is made by available by the author under the 
         <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 
            4.0 International License</a>.</span>
    

    如果这是我的“电流” 泰伊 文档我会通过模板处理它,但我不确定如何从不同的“当前”文档中复制和转换嵌套层。

    0 回复  |  直到 6 年前