Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
602 views
in Technique[技术] by (71.8m points)

xml - 现有代码中的大写集成(XSLT 1.0)(Upper-case integration in existing code (XSLT 1.0))

How correctly add an "upper-case" expression in already working XSLT code?

(如何在已经正常工作的XSLT代码中正确添加“大写”表达式?)

sample:

(样品:)

  <xsl:template match="Document">
    <Document  ABC="{element1/@attr1}{element2/@attr2}"
               DEF="{normalize-space(concat(element1/@attr-3, element1/element2/@attr4, ' ',element1/element2/@attr5, ' '))}"
               GHI="{element3/@attr6}">
      <xsl:copy-of select="@*" />
      <xsl:apply-templates/>
    </Document>
  </xsl:template>

need to up ABC, DEF, GHI' s values

(需要 提高 ABC,DEF,GHI的值)

Or, its better (or equal) to make this upper-case by the separate template?

(或者,通过单独的模板将此大写字母更好(或相等)吗?)

interesting in both possibilities

(两种可能性都很有趣)

  ask by Alex translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In XSLT 2.0 or more you can simply use the upper-case() method.

(在XSLT 2.0或更高版本中,您可以简单地使用upper-case()方法。)

Example:

(例:)

ABC="{upper-case(element1/@attr1)}{upper-case(element2/@attr2)}"

Or in XSLT 1.0, refer to this answer: How can I convert a string to upper- or lower-case with XSLT?

(或者在XSLT 1.0中,请参考以下答案: 如何使用XSLT将字符串转换为大写或小写?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...