亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 XSLT 1 將 XML 文檔轉換為 base64

使用 XSLT 1 將 XML 文檔轉換為 base64

慕姐8265434 2023-04-18 14:44:02
我需要使用 XSLT 1 轉換將 XML 文檔轉換為 base64。我嘗試使用此模板執行此操作:https ://github.com/ilyakharlamov/xslt_base64這是我的 XSL:<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:b64="https://github.com/ilyakharlamov/xslt_base64"  version="1.0">  <xsl:output method="text" encoding="utf-8" />  <xsl:strip-space elements="*"/>  <xsl:include href="base64.xsl"/>    <xsl:template match="/">  <xsl:call-template name="b64:encode" >            <xsl:with-param name="asciiString">              <xsl:copy-of select="." />            </xsl:with-param>        </xsl:call-template>   </xsl:template></xsl:stylesheet>這行得通,但它去除了所有 XML 標簽,只對文本進行編碼。我需要實際編碼所有內容(整個文檔,原樣)。將輸出方法更改為 XML 無濟于事。
查看完整描述

1 回答

?
慕無忌1623718

TA貢獻1744條經驗 獲得超4個贊

我是這樣做的:


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

? xmlns:b64="https://github.com/ilyakharlamov/xslt_base64"

? version="1.0">

<xsl:import href="xml-to-string.xsl"/>

? <xsl:output method="text" encoding="utf-8" />

? <xsl:strip-space elements="*"/>

? <xsl:include href="base64.xsl"/>

??

??

? <xsl:template match="/">

? <xsl:call-template name="b64:encode" >

? ? ? ? ? ? <xsl:with-param name="asciiString">

? ? ? ? ? ? ? <xsl:apply-templates select="." mode="xml-to-string" />

? ? ? ? ? ? </xsl:with-param>

? ? ? ? </xsl:call-template>

? ?</xsl:template>


</xsl:stylesheet>

使用這個: http: //lenzconsulting.com/xml-to-string/


查看完整回答
反對 回復 2023-04-18
  • 1 回答
  • 0 關注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號