【问题标题】:XSLT-2.0: How to create a text file using a BASE64String?XSLT-2.0:如何使用 BASE64String 创建文本文件?
【发布时间】:2017-03-13 05:50:21
【问题描述】:

我已经使用这个 XSLT 模板将 base64string 解码为字符串的一半:

<xsl:call-template name="b64:decode">
  <xsl:with-param name="base64String" select="'aGVsbG9fZHVkZS1hd2Vzb21lLnJ1'"></xsl:with-param>
</xsl:call-template>

我知道使用这个函数我们可以解码base64string但是

我有以下 XML 结构

<document>
  <reference>
    <text mediaType="text/plain" representation="B64">
      <reference value="Attachment For Sambar.txt" />
            aGVsbG9fZHVkZS1hd2Vzb21lLnJ1         
    </text>
</document>

如何使用 &lt;reference value="Attachment For Sambar.txt"&gt; 作为文件名从这个 XML 生成 .txt 文件

【问题讨论】:

    标签: xml xslt base64 xslt-2.0


    【解决方案1】:

    你可以写一个模板

    <xsl:template match="document/reference/text[@mediaType = 'text/plain' and @representation = 'B64']">
      <xsl:result-document href="reference/@value">
        <xsl:value-of select="bin:decode-string(xs:base64Binary(.))" xmlns:bin="http://expath.org/ns/binary"/>
      </xsl:result-document>
    </xsl:template>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-23
      • 2021-04-19
      • 2016-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多