0
我會在android系統轉換XML使用XSLT和代碼片段如下:android xml轉換錯誤:xsl:variable的select標籤中有多個值?
private String convertMathml2Svg() {
String result = "";
try {
Source xmlSource = new StreamSource(this.getResources().openRawResource(R.raw.testxml));
Source xsltSource = new StreamSource(this.getResources().openRawResource(R.raw.testxsl));
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
Writer writer = new StringWriter();
StreamResult resultStream = new StreamResult(writer);
trans.transform(xmlSource, resultStream);
result = writer.toString();
} catch (Exception e) {
Log.d(LOG_TAG, "EXCEPTION: " + e);
result = "";
}
return result;
}
當我在Android 4.4上運行此
,它如下提示錯誤:
W/System.err﹕ SystemId Unknown; Line #472; Column #2; Expected), but found: ,
的XSL代碼給出了這樣的錯誤是:
<xsl:variable name="XXX" select="('A', 'B', 'C')"/>
似乎變壓器不承認「」後‘A’,並期望它‘)’。
我不熟悉XSL語法,所以我請求任何幫助。
非常感謝!