Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过XSLT删除整个XML文档中的变音符号_Xml_Xslt_Diacritics - Fatal编程技术网

通过XSLT删除整个XML文档中的变音符号

通过XSLT删除整个XML文档中的变音符号,xml,xslt,diacritics,Xml,Xslt,Diacritics,我发现了很多关于通过XSLT函数translate(source、sourceChars、outputChars)转换特定元素/属性的信息,所以对于translate(“čašaž”、“čšž”、“csz”)=casaz 我需要XSLT模板,它转换每个节点和每个属性。 我不知道源XML的结构,所以它必须是通用的,不依赖于属性或元素名称和值 我正在寻找类似这种伪转换的东西: <xsl:template match="@*"> <xsl:copy>

我发现了很多关于通过XSLT函数translate(source、sourceChars、outputChars)转换特定元素/属性的信息,所以对于translate(“čašaž”、“čšž”、“csz”)=casaz

我需要XSLT模板,它转换每个节点和每个属性。 我不知道源XML的结构,所以它必须是通用的,不依赖于属性或元素名称和值

我正在寻找类似这种伪转换的东西:

  <xsl:template match="@*">
    <xsl:copy>
        <xsl:apply-templates select="translate( . , "čžš","czs")"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="node()">
    <xsl:copy>
      <xsl:apply-templates select="translate( . , "čžš","czs")"/>
    </xsl:copy>
  </xsl:template>

您可以为包含要规范化的数据的元素编写模板,下面我将为属性值、文本节点、注释节点和处理指令数据编写模板

<xsl:param name="in" select="'čžš'"/>
<xsl:param name="out" select="'czs'"/>

<xsl:template match="*">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="@*">
  <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
    <xsl:value-of select="translate(., $in, $out)"/>
  </xsl:attribute>
</xsl:template>

<xsl:template match="text()">
  <xsl:value-of select="translate(., $in, $out)"/>
</xsl:template>

<xsl:template match="comment()">
  <xsl:comment>
    <xsl:value-of select="translate(., $in, $out)"/>
  </xsl:comment>
</xsl:template>

<xsl:template match="processing-instruction()">
  <xsl:processing-instruction name="{name()}">
    <xsl:value-of select="translate(., $in, $out)"/>
  </xsl:processing-instruction>
</xsl:template>