CAMEL-7220 using the lasted schematron files from google code and added ASF license header to files
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e5973850 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e5973850 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e5973850 Branch: refs/heads/camel-2.14.x Commit: e5973850309b7d56fe1de0910c7e3fde5799838a Parents: 5c68ae1 Author: Willem Jiang <[email protected]> Authored: Fri Sep 12 23:19:13 2014 +0800 Committer: Willem Jiang <[email protected]> Committed: Fri Sep 12 23:39:44 2014 +0800 ---------------------------------------------------------------------- .../src/main/resources/META-INF/LICENSE.txt | 203 ++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../org/apache/camel/component/schematron | 32 +- .../ExtractSchFromRNG-2.xsl | 53 +- .../ExtractSchFromXSD-2.xsl | 201 +- .../iso_abstract_expand.xsl | 105 +- .../iso-schematron-xslt2/iso_dsdl_include.xsl | 2802 +++++++++--------- .../iso_schematron_message_xslt2.xsl | 133 +- .../iso_schematron_skeleton_for_saxon.xsl | 526 ++-- .../iso-schematron-xslt2/iso_svrl_for_xslt2.xsl | 56 +- .../iso-schematron-xslt2/sch-messages-cs.xhtml | 16 + .../iso-schematron-xslt2/sch-messages-de.xhtml | 20 +- .../iso-schematron-xslt2/sch-messages-en.xhtml | 18 +- .../iso-schematron-xslt2/sch-messages-fr.xhtml | 18 +- .../iso-schematron-xslt2/sch-messages-nl.xhtml | 16 + .../schematron-skeleton-api.htm | 16 + .../test/resources/report/article-1-report.xml | 16 + .../test/resources/report/article-2-report.xml | 16 + .../src/test/resources/sch/schematron-1.sch | 18 +- .../src/test/resources/sch/schematron-2.sch | 18 +- .../src/test/resources/schema/article.xsd | 16 + .../src/test/resources/xml/article-1.xml | 16 + .../src/test/resources/xml/article-2.xml | 16 + 23 files changed, 2496 insertions(+), 1846 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/META-INF/LICENSE.txt ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/META-INF/LICENSE.txt b/components/camel-schematron/src/main/resources/META-INF/LICENSE.txt new file mode 100755 index 0000000..6b0b127 --- /dev/null +++ b/components/camel-schematron/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/META-INF/NOTICE.txt ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/META-INF/NOTICE.txt b/components/camel-schematron/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/components/camel-schematron/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/META-INF/services/org/apache/camel/component/schematron ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/META-INF/services/org/apache/camel/component/schematron b/components/camel-schematron/src/main/resources/META-INF/services/org/apache/camel/component/schematron index 5f2af4c..c5c3bdb 100644 --- a/components/camel-schematron/src/main/resources/META-INF/services/org/apache/camel/component/schematron +++ b/components/camel-schematron/src/main/resources/META-INF/services/org/apache/camel/component/schematron @@ -1,18 +1,18 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# class=org.apache.camel.component.schematron.SchematronComponent http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl index 38d2d8e..9fc90c7 100644 --- a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +++ b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl @@ -1,10 +1,61 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- Stylesheet for extracting Schematron information from a RELAX-NG schema. Based on the stylesheet for extracting Schematron information from W3C XML Schema. + + For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html + Created by Eddie Robertsson 2002/06/01 - Update for ISO Schematron using XSLT2 Rick Jelliffe 2010/04/14 + Update for ISO Schematron using XSLT2 Rick Jelliffe 2010-04-14 + MIT licensed 2010-07-10 +--> + +<!-- +Open Source Initiative OSI - The MIT License:Licensing +[OSI Approved License] + +Attribution is polite. + +The MIT License + +Copyright (c) 2002-2010 Rick Jelliffe and Topologi Pty. Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. --> + + <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0"> <!-- Set the output to be XML with an XML declaration and use indentation --> http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl index 7d1cbfb..39a21e2 100644 --- a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +++ b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl @@ -1,77 +1,126 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - based on an original transform by Eddie Robertsson - 2001/04/21 fn: added support for included schemas - 2001/06/27 er: changed XMl Schema prefix from xsd: to xs: and changed to the Rec namespace - 2010/04/14 rj: Update for ISO Schematron using xslt2 ---> -<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" -xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <!-- Set the output to be XML with an XML declaration and use indentation --> - <xsl:output method="xml" omit-xml-declaration="no" indent="yes" standalone="yes"/> - <!-- --> - <!-- match schema and call recursive template to extract included schemas --> - <!-- --> - <xsl:template match="xs:schema"> - <!-- call the schema definition template ... --> - <xsl:call-template name="gatherSchema"> - <!-- ... with current current root as the $schemas parameter ... --> - <xsl:with-param name="schemas" select="/"/> - <!-- ... and any includes in the $include parameter --> - <xsl:with-param name="includes" - select="document(/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/> - </xsl:call-template> - </xsl:template> - <!-- --> - <!-- gather all included schemas into a single parameter variable --> - <!-- --> - <xsl:template name="gatherSchema"> - <xsl:param name="schemas"/> - <xsl:param name="includes"/> - <xsl:choose> - <xsl:when test="count($schemas) < count($schemas | $includes)"> - <!-- when $includes includes something new, recurse ... --> - <xsl:call-template name="gatherSchema"> - <!-- ... with current $includes added to the $schemas parameter ... --> - <xsl:with-param name="schemas" select="$schemas | $includes"/> - <!-- ... and any *new* includes in the $include parameter --> - <xsl:with-param name="includes" - select="document($includes/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <!-- we have the complete set of included schemas, - so now let's output the embedded schematron --> - <xsl:call-template name="output"> - <xsl:with-param name="schemas" select="$schemas"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - <!-- --> - <!-- output the schematron information --> - <!-- --> - <xsl:template name="output"> - <xsl:param name="schemas"/> - <!-- --> - <sch:schema queryBinding="xslt2"> - <!-- get header-type elements - eg title and especially ns --> - <!-- title (just one) --> - <xsl:copy-of select="$schemas//xs:appinfo/sch:title[1]"/> - <!-- get remaining schematron schema children --> - <!-- get non-blank namespace elements, dropping duplicates --> - <xsl:for-each select="$schemas//xs:appinfo/sch:ns"> - <xsl:if test="generate-id(.) = - generate-id($schemas//xs:appinfo/sch:ns[@prefix = current()/@prefix][1])"> - <xsl:copy-of select="."/> - </xsl:if> - </xsl:for-each> - <xsl:copy-of select="$schemas//xs:appinfo/sch:phase"/> - <xsl:copy-of select="$schemas//xs:appinfo/sch:pattern"/> - <sch:diagnostics> - <xsl:copy-of select="$schemas//xs:appinfo/sch:diagnostics/*"/> - </sch:diagnostics> - </sch:schema> - </xsl:template> - <!-- --> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- + Extract embedded Schematron schemas in W3C XML Schemas schemas + + For usage details, see http://www.topologi.com/resources/schtrn_xsd_paper.html + + based on an original transform by Eddie Robertsson + 2001/04/21 fn: added support for included schemas + 2001/06/27 er: changed XMl Schema prefix from xsd: to xs: and changed to the Rec namespace + 2010/04/14 rj: Update for ISO Schematron using xslt2 MIT licensed 2010-07-10 +--> + +<!-- +Open Source Initiative OSI - The MIT License:Licensing +[OSI Approved License] + +Attribution is polite. + +The MIT License + +Copyright (c) 2002-2010 Rick Jelliffe and Topologi Pty. Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <!-- Set the output to be XML with an XML declaration and use indentation --> + <xsl:output method="xml" omit-xml-declaration="no" indent="yes" standalone="yes"/> + <!-- --> + <!-- match schema and call recursive template to extract included schemas --> + <!-- --> + <xsl:template match="xs:schema"> + <!-- call the schema definition template ... --> + <xsl:call-template name="gatherSchema"> + <!-- ... with current current root as the $schemas parameter ... --> + <xsl:with-param name="schemas" select="/"/> + <!-- ... and any includes in the $include parameter --> + <xsl:with-param name="includes" + select="document(/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/> + </xsl:call-template> + </xsl:template> + <!-- --> + <!-- gather all included schemas into a single parameter variable --> + <!-- --> + <xsl:template name="gatherSchema"> + <xsl:param name="schemas"/> + <xsl:param name="includes"/> + <xsl:choose> + <xsl:when test="count($schemas) < count($schemas | $includes)"> + <!-- when $includes includes something new, recurse ... --> + <xsl:call-template name="gatherSchema"> + <!-- ... with current $includes added to the $schemas parameter ... --> + <xsl:with-param name="schemas" select="$schemas | $includes"/> + <!-- ... and any *new* includes in the $include parameter --> + <xsl:with-param name="includes" + select="document($includes/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- we have the complete set of included schemas, + so now let's output the embedded schematron --> + <xsl:call-template name="output"> + <xsl:with-param name="schemas" select="$schemas"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- --> + <!-- output the schematron information --> + <!-- --> + <xsl:template name="output"> + <xsl:param name="schemas"/> + <!-- --> + <sch:schema queryBinding="xslt2"> + <!-- get header-type elements - eg title and especially ns --> + <!-- title (just one) --> + <xsl:copy-of select="$schemas//xs:appinfo/sch:title[1]"/> + <!-- get remaining schematron schema children --> + <!-- get non-blank namespace elements, dropping duplicates --> + <xsl:for-each select="$schemas//xs:appinfo/sch:ns"> + <xsl:if test="generate-id(.) = + generate-id($schemas//xs:appinfo/sch:ns[@prefix = current()/@prefix][1])"> + <xsl:copy-of select="."/> + </xsl:if> + </xsl:for-each> + <xsl:copy-of select="$schemas//xs:appinfo/sch:phase"/> + <xsl:copy-of select="$schemas//xs:appinfo/sch:pattern"/> + <sch:diagnostics> + <xsl:copy-of select="$schemas//xs:appinfo/sch:diagnostics/*"/> + </sch:diagnostics> + </sch:schema> + </xsl:template> + <!-- --> </xsl:transform> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/e5973850/components/camel-schematron/src/main/resources/iso-schematron-xslt2/iso_abstract_expand.xsl ---------------------------------------------------------------------- diff --git a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/iso_abstract_expand.xsl b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/iso_abstract_expand.xsl index f2f1667..bdf6d9c 100644 --- a/components/camel-schematron/src/main/resources/iso-schematron-xslt2/iso_abstract_expand.xsl +++ b/components/camel-schematron/src/main/resources/iso-schematron-xslt2/iso_abstract_expand.xsl @@ -1,15 +1,31 @@ <?xml version="1.0" encoding="UTF-8"?><?xar XSLT?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> <!-- OVERVIEW - iso_abstract_expand.xsl This is a preprocessor for ISO Schematron, which implements abstract patterns. It also * extracts a particular schema using an ID, where there are multiple - schemas, such as when they are embedded in the same NVDL script - * experimentally, allows parameter recognition and substitution inside - text as well as @context, @test, & @select. - + schemas, such as when they are embedded in the same NVDL script + * allows parameter substitution inside @context, @test, @select, @path + * experimentally, allows parameter recognition and substitution inside + text (NOTE: to be removed, for compataibility with other implementations, + please do not use this) This should be used after iso-dsdl-include.xsl and before the skeleton or meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1. @@ -17,10 +33,47 @@ Each kind of inclusion can be turned off (or on) on the command line. --> -<!-- - VERSION INFORMATION - 2008-09-18 RJ - * move out param test from iso:schema template to work with XSLT 1. (Noah Fontes) + +<!-- +Open Source Initiative OSI - The MIT License:Licensing +[OSI Approved License] + +This source code was previously available under the zlib/libpng license. +Attribution is polite. + +The MIT License + +Copyright (c) 2004-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> + +<!-- +VERSION INFORMATION + 2013-09-19 RJ + * Allow macro expansion in @path attributes, eg. for sch:name/@path + + 2010-07-10 RJ + * Move to MIT license + + 2008-09-18 RJ + * move out param test from iso:schema template to work with XSLT 1. (Noah Fontes) 2008-07-29 RJ * Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl @@ -40,29 +93,6 @@ * Original written for old namespace * http://www.topologi.com/resources/iso-pre-pro.xsl --> -<!-- - LEGAL INFORMATION - - Copyright (c) 2000-2008 Rick Jelliffe and Academia Sinica Computing Center, Taiwan - - This software is provided 'as-is', without any express or implied warranty. - In no event will the authors be held liable for any damages arising from - the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it freely, - subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not claim - that you wrote the original software. If you use this software in a product, - an acknowledgment in the product documentation would be appreciated but is - not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. ---> <xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:iso="http://purl.oclc.org/dsdl/schematron" @@ -85,12 +115,12 @@ <!-- Normal processing rules --> <!-- ================================================================================== --> <!-- Output only the selected schema --> - <xslt:template match="iso:schema" > + <xslt:template match="iso:schema" > <xsl:if test="string-length($schema-id) =0 or @id= $schema-id "> <xslt:copy> <xslt:copy-of select="@*" /> <xslt:apply-templates mode="iae:go" /> - </xslt:copy> + </xslt:copy> </xsl:if> </xslt:template> @@ -135,7 +165,7 @@ <!-- Suppress uses of abstract patterns --> - <xslt:template match="iso:pattern[@is-a]" mode="iae:go" > + <xslt:template match="iso:pattern[@is-a]" mode="iae:go" > <xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment> @@ -230,7 +260,7 @@ <xslt:template mode="iae:do-pattern" match="*"> <xslt:param name="caller"/> <xslt:copy> - <xslt:for-each select="@*[name()='test' or name()='context' or name()='select']"> + <xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]"> <xslt:attribute name="{name()}"> <xslt:call-template name="iae:macro-expand"> <xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param> @@ -238,12 +268,13 @@ </xslt:call-template> </xslt:attribute> </xslt:for-each> - <xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select']" /> + <xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" /> <xsl:for-each select="node()"> <xsl:choose> <!-- Experiment: replace macros in text as well, to allow parameterized assertions and so on, without having to have spurious <iso:value-of> calls and multiple - delimiting --> + delimiting. + NOTE: THIS FUNCTIONALITY WILL BE REMOVED IN THE FUTURE --> <xsl:when test="self::text()"> <xslt:call-template name="iae:macro-expand"> <xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
