나는 this 답변에 따라 스타일 시트를 사용하여, XSLT2 실험 해요 :XSLT2 replace() 함수에서 엔티티 변환을 어떻게 혼합하고 일치 시키나요?
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" version="1.1">
<file>
<source>abc <field1> def <field2> ghi</source>
</file>
</xliff>
에 :
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns:xliff="urn:oasis:names:tc:xliff:document:1.1" version="1.1">
<file>
<source>abc <ph><field1></ph> def <ph><field2></ph> ghi</source>
</file>
</xliff>
것입니다
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="source/text()">
<xsl:sequence select="replace(., '<.*?>', '<ph>$0</ph>')"/>
</xsl:template>
</xsl:stylesheet>
여러 대체 예에서 할
하지만 변환이 유효하지 않습니다.이 오류가 발생합니다.
Error on line 12 column 54 of my.xsl:
SXXP0003: Error reported by XML parser: The value of attribute "select" associated with an
element type "null" must not contain the '<' character.
select="replace(., '<(.*?)>', '<ph>F</phgt;')"
을 사용하는 경우 출력에 ...<ph>...
이 표시됩니다.
DOE을 사용하는 경우 현장에 다른 항목이있을 수 있으므로 다른 문제를 소개합니다. 손길이 닿지 않으려 고합니다. <xsl:output method="text"/>
을 사용하면 대부분의 XML을 잃어 버리게됩니다. 이와 같은 '믹싱 및 매칭'의 다른 방법이 있습니까?
이 가능하며, 문자열 대체는 아닙니다. –