-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSRule - Failed to compile XPath expression in <rule>: '//*[. is nf:get-document-element(.)]' #77
Comments
Hi.
|
hello ! schematron is <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" queryBinding="xslt2">
<sch:title>NIEM example</sch:title>
<xsl:include href="ndr-functions.xsl"/>
<sch:ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/>
<sch:ns prefix="xsl" uri="http://www.w3.org/1999/XSL/Transform"/>
<sch:ns prefix="nf" uri="http://reference.niem.gov/niem/specification/naming-and-design-rules/4.0/#NDRFunctions"/>
<sch:ns prefix="ct" uri="http://release.niem.gov/niem/conformanceTargets/3.0/"/>
<sch:ns prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance"/>
<sch:ns prefix="appinfo" uri="http://release.niem.gov/niem/appinfo/4.0/"/>
<sch:ns prefix="structures" uri="http://release.niem.gov/niem/structures/4.0/"/>
<sch:pattern id="rule_7-4"><sch:title>Document element is xs:schema</sch:title>
<sch:rule context="*[. is nf:get-document-element(.)]">
<sch:assert test="self::xs:schema">Rule 7-4: The [document element] of the [XML document] MUST have the name xs:schema.</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema> and i change my xml to : <?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://release.niem.org/niem/sample/1.0/NegativeSample-4-1-1/" version="1.0"
blockDefault="" elementFormDefault="qualified"
finalDefault=""
xmlns:NS-4-1-1="http://release.niem.org/niem/sample/1.0/NegativeSample-4-1-1/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
<xs:annotation>
<xs:documentation xml:lang="EN">The negative sample for the rule 4-1 in chapter 4.</xs:documentation>
</xs:annotation>
</xs:schema> thank you very much |
invoke it by Plain Java code final PSReader aReader = new PSReader(aRes); |
Ok thanks. Schematron looks okay. final ISchematronResource aSV = SchematronResourceSCH.fromfromFile ("patth/to/your.sch");
final Document aDoc = aSV.applySchematronValidation (new FileSystemResource ("path/to/your.xml"));
System.out.println (com.helger.xml.serialize.write.XMLWriter.getNodeAsString (aDoc)); Please ensure that the included XSL resides in the same folder as the SCH file |
hello!I'm sorry to bother you. i have try my best to do it,but it doesnt work. i cant find the reason. I wish to ask a favour of you. i push my project to github, I hope to get your help. ,I'm sorry to take up your time. think you very much ,thank you https://github.com/SnowMakerDemo/schematronTest.git |
It is indeed tricky - never used Schematron with XSLT includes.... Will play around with it and let you know :) |
OK thank you ,very thanks , i will change the content to xpath ,thank you :) |
hello i have another question。:) schematron is : xml is : </xs:complexType> |
I am out of office today. You need to declare the appinfo NS prefix explicitly. Attributes with namespaces are tricky in XPath... |
thank you,I'm particularly grateful to you for having taken time out of your busy schedules to reply me. the holiday,i got merried,I didn't reply to you in time. that question is my mistake, sch import uri is different from xml import , i change it, now it‘s ok thank you |
Ah okay - congratulations on your marriage 😄 |
thank you,:) schematron : <sch:ns prefix="appinfo" uri="http://release.niem.gov/niem/appinfo/4.0/"/> |
I think I found the error and fixed it in 5.1.0. The problem was a missing
I will create the 5.1.0 release soon |
When I saw it, I was really happy, it solved my problem,thank you very much. 👍 👍 |
hello,i have a question, content is: why Cannot find a 1-argument function named Q{http://reference.niem.gov/niem/specification/naming-and-design-rules/4.0/#NDRFunctions}get-document-element(). External function calls have been disabled,
schamatron is :
xml is :
thanks
The text was updated successfully, but these errors were encountered: