1
0
mirror of https://github.com/alexandrev/xslt-lab.git synced 2026-09-14 09:03:15 +00:00

SEO: turn the string-functions roundup into a hub linking dedicated pages

GSC shows the dedicated function pages already rank well — xpath-contains
at pos 3.3, xpath-substring at pos 5.8 — but the string-functions roundup
post competed with them for the same terms and often outranked the better
page at a worse position (e.g. it took "substring" impressions at pos 17
while xpath-substring sat at pos 5.8). Classic self-cannibalization.

- string-functions: link every function in the at-a-glance table to its
  dedicated /xslt/functions/ reference page (18 of 19 exist). The roundup
  now consolidates authority into the pages that already win and keeps the
  head term "xslt string functions" for itself, instead of splitting
  signals across both.
- template-matching (ranks pos 5.4 for "template match", no cannibalism):
  link the "mode" and "apply-templates" mentions to their reference pages —
  it previously linked to nothing but the homepage.

Hugo build verified locally (345 pages, exit 0); links resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDk5guu51FjFxQMjgrrekW
This commit is contained in:
2026-07-22 20:20:49 +00:00
parent c9078842d4
commit 9bedbc3dc9
2 changed files with 19 additions and 17 deletions
+17 -15
View File
@@ -9,23 +9,25 @@ String manipulation is one of the most common tasks in XSLT. Whether you are for
## XSLT string functions at a glance
Each function name links to its full reference page with the complete signature and edge cases; the sections below give quick runnable examples.
| Function | Purpose | Minimum version |
|---|---|---|
| `string-length` | Number of characters in a string | XSLT 1.0 |
| `substring` | Extract part of a string by position | XSLT 1.0 |
| `substring-before` / `substring-after` | Split a string on a delimiter | XSLT 1.0 |
| `contains` / `starts-with` | Test for a substring or prefix | XSLT 1.0 |
| `concat` | Join strings together | XSLT 1.0 |
| `normalize-space` | Trim and collapse whitespace | XSLT 1.0 |
| `translate` | Replace characters one-for-one | XSLT 1.0 |
| `upper-case` / `lower-case` | Change case | XSLT 2.0 |
| `ends-with` | Test for a suffix | XSLT 2.0 |
| `replace` | Regex-based substitution | XSLT 2.0 |
| `matches` | Test a string against a regex | XSLT 2.0 |
| `tokenize` | Split a string into a sequence by regex | XSLT 2.0 |
| `string-join` | Join a sequence with a separator | XSLT 2.0 |
| `format-number` | Format a number with a picture pattern | XSLT 1.0 |
| `format-date` / `format-dateTime` | Format dates with a picture string | XSLT 2.0 |
| [`string-length`](/xslt/functions/xpath-string-length/) | Number of characters in a string | XSLT 1.0 |
| [`substring`](/xslt/functions/xpath-substring/) | Extract part of a string by position | XSLT 1.0 |
| [`substring-before`](/xslt/functions/xpath-substring-before/) / [`substring-after`](/xslt/functions/xpath-substring-after/) | Split a string on a delimiter | XSLT 1.0 |
| [`contains`](/xslt/functions/xpath-contains/) / [`starts-with`](/xslt/functions/xpath-starts-with/) | Test for a substring or prefix | XSLT 1.0 |
| [`concat`](/xslt/functions/xpath-concat/) | Join strings together | XSLT 1.0 |
| [`normalize-space`](/xslt/functions/xpath-normalize-space/) | Trim and collapse whitespace | XSLT 1.0 |
| [`translate`](/xslt/functions/xpath-translate/) | Replace characters one-for-one | XSLT 1.0 |
| [`upper-case`](/xslt/functions/xpath-upper-case/) / [`lower-case`](/xslt/functions/xpath-lower-case/) | Change case | XSLT 2.0 |
| [`ends-with`](/xslt/functions/xpath-ends-with/) | Test for a suffix | XSLT 2.0 |
| [`replace`](/xslt/functions/xpath-replace/) | Regex-based substitution | XSLT 2.0 |
| [`matches`](/xslt/functions/xpath-matches/) | Test a string against a regex | XSLT 2.0 |
| [`tokenize`](/xslt/functions/xpath-tokenize/) | Split a string into a sequence by regex | XSLT 2.0 |
| [`string-join`](/xslt/functions/xpath-string-join/) | Join a sequence with a separator | XSLT 2.0 |
| [`format-number`](/xslt/functions/xpath-format-number/) | Format a number with a picture pattern | XSLT 1.0 |
| [`format-date`](/xslt/functions/xpath-format-date/) / `format-dateTime` | Format dates with a picture string | XSLT 2.0 |
Each function is explained with runnable examples below. Try them in the [XSLT 2.0 online tester](https://xsltplayground.com/xslt-2-0/) for the 2.0 functions, or the main [online XSLT editor](https://xsltplayground.com) for the 1.0 ones.
@@ -59,7 +59,7 @@ This overrides the built-in with an empty template, producing no output for text
## Modes
Modes let you have multiple templates for the same node that serve different purposes. A mode is a named context for a set of templates.
Modes let you have multiple templates for the same node that serve different purposes. A [mode](/xslt/functions/xsl-mode/) is a named context for a set of templates.
```xml
<!-- Default mode: output a summary row -->
@@ -86,7 +86,7 @@ Modes are especially useful when you need to process the same nodes in multiple
## apply-templates vs for-each
Both iterate over a set of nodes. The difference is that `apply-templates` dispatches to the best matching template for each node, while `for-each` stays in the current context and does not do template lookup.
Both iterate over a set of nodes. The difference is that [`apply-templates`](/xslt/functions/xsl-apply-templates/) dispatches to the best matching template for each node, while `for-each` stays in the current context and does not do template lookup.
Use `apply-templates` when you want polymorphism — different node types handled differently. Use `for-each` when you are doing a simple iteration over a homogeneous set and do not need dispatch.