xref: /aosp_15_r20/external/apache-xml/test/tests/extensions/library/libraryDifference01.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
3    xmlns:xalan="http://xml.apache.org/xalan"
4    exclude-result-prefixes="xalan">
5<xsl:output indent="yes"/>
6
7  <!-- FileName: libraryDifference01.xsl -->
8  <!-- Creator: Shane Curcuru -->
9  <!-- Purpose: Basic test of difference(ns, ns) extension function -->
10
11<xsl:template match="doc">
12  <out>
13    <test desc="selects abc (abc, xyz)">
14      <xsl:copy-of select="xalan:difference(list[@name='abc']/item, list[@name='xyz']/item)"/>
15      <xsl:text>, </xsl:text>
16      <xsl:value-of select="xalan:difference(list[@name='abc']/item, list[@name='xyz']/item)"/>
17    </test>
18    <test desc="selects xyz (xyz, abc)">
19      <xsl:copy-of select="xalan:difference(list[@name='xyz']/item, list[@name='abc']/item)"/>
20    </test>
21    <test desc="selects nothing (abc, abc)">
22      <xsl:copy-of select="xalan:difference(list[@name='abc']/item, list[@name='abc']/item)"/>
23    </test>
24    <test desc="selects nothing (abc, abc and parent)">
25      <xsl:copy-of select="xalan:difference(list[@name='abc'], list[@name='abc'])"/>
26    </test>
27    <test desc="selects bc (abc, abc[1])">
28      <xsl:copy-of select="xalan:difference(list[@name='abc']/item, list[@name='abc']/item[1])"/>
29    </test>
30    <test desc="selects nothing (abc[1], abc)">
31      <xsl:copy-of select="xalan:difference(list[@name='abc']/item[1], list[@name='abc']/item)"/>
32    </test>
33    <test desc="selects a (abc[1], abc[2])">
34      <xsl:copy-of select="xalan:difference(list[@name='abc']/item[1], list[@name='abc']/item[2])"/>
35    </test>
36  </out>
37</xsl:template>
38
39
40  <!--
41   * Licensed to the Apache Software Foundation (ASF) under one
42   * or more contributor license agreements. See the NOTICE file
43   * distributed with this work for additional information
44   * regarding copyright ownership. The ASF licenses this file
45   * to you under the Apache License, Version 2.0 (the  "License");
46   * you may not use this file except in compliance with the License.
47   * You may obtain a copy of the License at
48   *
49   *     http://www.apache.org/licenses/LICENSE-2.0
50   *
51   * Unless required by applicable law or agreed to in writing, software
52   * distributed under the License is distributed on an "AS IS" BASIS,
53   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54   * See the License for the specific language governing permissions and
55   * limitations under the License.
56  -->
57
58</xsl:stylesheet>
59