From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/exslt/index.html | 93 +++++++++++++++++++++++++++ files/zh-cn/web/exslt/regexp/index.html | 9 +++ files/zh-cn/web/exslt/regexp/match/index.html | 69 ++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 files/zh-cn/web/exslt/index.html create mode 100644 files/zh-cn/web/exslt/regexp/index.html create mode 100644 files/zh-cn/web/exslt/regexp/match/index.html (limited to 'files/zh-cn/web/exslt') diff --git a/files/zh-cn/web/exslt/index.html b/files/zh-cn/web/exslt/index.html new file mode 100644 index 0000000000..9f272473a5 --- /dev/null +++ b/files/zh-cn/web/exslt/index.html @@ -0,0 +1,93 @@ +--- +title: EXSLT +slug: Web/EXSLT +tags: + - EXSLT + - NeedsTranslation + - TopicStub + - XSLT + - XSLT_Reference +translation_of: Web/EXSLT +--- +

+{{ XsltRef() }} +{{ Fx_minversion_header(3) }} +EXSLT is a set of extensions to XSLT. There are a number of modules; those that are supported by Firefox are listed below: +

+
Common (exsl) +
Provides basic extension elements and functions. +
Math (math) +
Provides routines for comparing nodes. +
Regular expressions (regexp) +
Provides facilities for using regular expressions in JavaScript syntax. +
Sets (set) +
Provides routines for manipulating sets. +
Strings (str) +
Provides functions for string manipulation. +
+

Using EXSLT

+

To use an EXSLT function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. For example, to use the regular expressions package: +

+
<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:regexp="http://exslt.org/regular-expressions">
+  <xsl:template match="/">
+    ...
+    <xsl:value-of select="regexp:replace(/root/@value, 'before', 'gi', 'AFTER')"/>
+    ...
+  </xsl:template>
+
+</xsl:stylesheet>
+
+

Common

+

The EXSLT Common package provides basic functions that expand upon the capabilities of XSLT. The namespace for the Common package is http://exslt.org/common. +

+

Functions

+ +

Math

+

The EXSLT Math package provides functions for working with numeric values and comparing nodes. The namespace for the Math package is http://exslt.org/math. +

+

Functions

+ +

Regular expressions

+

The EXSLT Regular Expressions package provides functions that allow testing, matching, and replacing text using JavaScript style regular expressions. +

The EXSLT Regular Expressions namespace is http://exslt.org/regular-expressions. +

+

Functions

+ +

Sets

+

The EXSLT Sets package offers functions that let you perform set manipulation. The namespace for these functions is http://exslt.org/sets. +

+

Functions

+ +

Strings

+

The EXSLT Strings package provides functions that allow the manipulation of strings. The namespace for the Strings package is http://exslt.org/strings. +

+

Functions

+ +

See also

+ +


+

+
+
+{{ languages( { "es": "es/EXSLT", "fr": "fr/EXSLT", "ja": "ja/EXSLT", "pl": "pl/EXSLT" } ) }} diff --git a/files/zh-cn/web/exslt/regexp/index.html b/files/zh-cn/web/exslt/regexp/index.html new file mode 100644 index 0000000000..23f49c31e3 --- /dev/null +++ b/files/zh-cn/web/exslt/regexp/index.html @@ -0,0 +1,9 @@ +--- +title: regexp +slug: Web/EXSLT/regexp +tags: + - NeedsTranslation + - TopicStub +translation_of: Web/EXSLT/regexp +--- +{{wiki.localize('System.API.page-generated-for-subpage')}} diff --git a/files/zh-cn/web/exslt/regexp/match/index.html b/files/zh-cn/web/exslt/regexp/match/index.html new file mode 100644 index 0000000000..2aebf1da22 --- /dev/null +++ b/files/zh-cn/web/exslt/regexp/match/index.html @@ -0,0 +1,69 @@ +--- +title: match +slug: Web/EXSLT/regexp/match +translation_of: Web/EXSLT/regexp/match +--- +

{{ XsltRef() }} {{ Fx_minversion_header(3) }}

+ +


+ regexp:match() performs regular expression matching on a string, returning the submatches found as a result.

+ +

语法

+ +
regexp:match(targetString,regExpString[[,flagsString]])
+
+ +

参数

+ +
+
targetString
+
The string to perform regular expression matching upon.
+
regExpString
+
The JavaScript style regular expression to evaluate.
+
flagsString
+
An optional string containing character flags.
+
+ +

The character flags are:

+ +
+
g
+
全局匹配
+
The submatches from every match in the string are returned. If this flag isn't specified, only the submatches from the first match are returned.
+
i
+
Case insensitive match
+
If this flag is specified, the match is performed in a case insensitive fashion.
+
+ +

Returns

+ +

A node set of match elements, each of which has the string value equal to a portion of the first parameter string as captured by the regular expression. If the match isn't a global one, the first match element has the value of the portion of the string matched by the entire regular expression.

+ +

例如:

+ +
<xsl:for-each select="regExp:match('http://developer.mozilla.org/en/docs/Firefox_3_for_developers',
+                                   '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')">
+   Part <xsl:value-of select="position()" /> = <xsl:value-of select="." />
+</xsl:for-each>
+
+ +

This code generates the following output:

+ +
Part 1 = http://developer.mozilla.org/en/docs/Firefox_3_for_developers
+Part 2 = http
+Part 3 = developer.mozilla.org
+Part 4 =
+Part 5 = /en/docs/Firefox_3_for_developers
+
+ +

定义

+ +

EXSLT - REGEXP:MATCH

+ +

Gecko support

+ +

Supported in Gecko 1.9 and later.

+ +
 
+ +

{{ languages( { "es": "es/EXSLT/regexp/match", "fr": "fr/EXSLT/regexp/match" } ) }}

-- cgit v1.2.3-54-g00ecf