Customer function in schematron
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 11
- Joined: Mon Mar 21, 2016 4:08 pm
Customer function in schematron
I am attempting to add a custom function to my schematron rule stylesheet to aid in looking up values in code tables. I continue to receive an error message: "unrecognized element xsl:function from namespace http://www.w3.org/1999/Transform''
At the top of the file, I have the following declarations:
and the function declaration as:
in the body, I use the rule:
What am I missing?
At the top of the file, I have the following declarations:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:local-fn="functions:1.0"
xmlns:regexp="http://exslt.org/regular-expressions"
queryBinding="xslt2">
<sch:ns uri="functions:1.0" prefix="local-fn" />
Code: Select all
<!-- *********************************** Functions *********************** -->
<!-- special variables for lookup table -->
<xsl:key name="Code-Lookup" match="CodeTable" use="Code"/>
<xsl:variable name="codeTables" select="document('LookupCodes.xml')/CodeTable"/>
<!-- function to return an expression to be evaluated in the rule containing the codes from the given code table -->
<xsl:function name="local-fn:BuildLookupExpression" as="xs:string">
<xsl:param name="TableName" as="xs:string"/>
<xsl:text>(</xsl:text>
<xsl:for-each select="key('Code-Lookup', $TableName)/Code">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>)|(</xsl:text>
</xsl:if>
<xsl:if test="position() = last()">
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:function>
in the body, I use the rule:
Code: Select all
<sch:pattern id="SEXValue">
<sch:title>Person Sex</sch:title>
<sch:p class="description">
This field is used to report the gender of the subject.
See SEX Table: [F, G, M, N, X, Y, Z]
</sch:p>
<let name="SEXExpression" value="local-fn:BuildLookupExpression('SEX')"/>
<sch:rule context="nc:PersonSexCode">
<let name="SEXString" value="string(.)"/>
<sch:assert test="matches($SEXString, $SEXExpression)">
<sch:value-of select="name(.)" /> must be in the set of: [F, G, M, N, X, Y, Z]
</sch:assert>
</sch:rule>
</sch:pattern>
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Customer function in schematron
Post by radu_pisoi »
Hi,
Thank you for contacting us.
You should activate the option 'Allow foreign elements (allow-foreign)' from the 'XML / XML Parser / Schematron' option page. This option is used to pass non-Schematron elements to the generated stylesheet.
Thank you for contacting us.
You should activate the option 'Allow foreign elements (allow-foreign)' from the 'XML / XML Parser / Schematron' option page. This option is used to pass non-Schematron elements to the generated stylesheet.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service