xref: /aosp_15_r20/external/apache-xml/test/tests/exslt/strings/strings1.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0"
3                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4                xmlns:str="http://exslt.org/strings"
5                extension-element-prefixes="str">
6
7<xsl:template match="a/name">
8   <xsl:apply-templates/>
9</xsl:template>
10
11<xsl:template match="*">
12<out>
13   Left-justified with padding longer than name:
14   <xsl:value-of select="//name[1]" /> -
15   <xsl:value-of select="str:align(//name[1], '-X-O-X-O-X-O-X-O-X-O-X-O-X-O-X-O-X-O-X-O-X-O', 'left')" />
16   Right-justified with padding longer than name:
17   <xsl:value-of select="//name[2]" /> -
18   <xsl:value-of select="str:align(//name[2], 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn', 'right')" />
19   Centered with padding longer than name:
20   <xsl:value-of select="//name[3]" /> -
21   <xsl:value-of select="str:align(//name[3], 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', 'center')" />
22   Left-justified with padding shorter than name:
23   <xsl:value-of select="//name[4]" /> -
24   <xsl:value-of select="str:align(//name[4], 'DDDDD', 'left')" />
25   Right-justified with null padding than name:
26   <xsl:value-of select="//name[5]" /> -
27   <xsl:value-of select="str:align(//name[5], '', 'right')" />
28   Default justification is left-justified:
29   <xsl:value-of select="//name[6]" /> -
30   <xsl:value-of select="str:align(//name[6], 'ooooooooooooooooooooooooooooooo')" />
31</out>
32</xsl:template>
33
34
35  <!--
36   * Licensed to the Apache Software Foundation (ASF) under one
37   * or more contributor license agreements. See the NOTICE file
38   * distributed with this work for additional information
39   * regarding copyright ownership. The ASF licenses this file
40   * to you under the Apache License, Version 2.0 (the  "License");
41   * you may not use this file except in compliance with the License.
42   * You may obtain a copy of the License at
43   *
44   *     http://www.apache.org/licenses/LICENSE-2.0
45   *
46   * Unless required by applicable law or agreed to in writing, software
47   * distributed under the License is distributed on an "AS IS" BASIS,
48   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49   * See the License for the specific language governing permissions and
50   * limitations under the License.
51  -->
52
53</xsl:stylesheet>
54