Skip to content
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

Picking up variables in 'let' schematron statements #36

Closed
jkiddo opened this issue Feb 22, 2017 · 6 comments
Closed

Picking up variables in 'let' schematron statements #36

jkiddo opened this issue Feb 22, 2017 · 6 comments
Assignees
Labels

Comments

@jkiddo
Copy link

jkiddo commented Feb 22, 2017

It seems that the declared variables in 'let statements' are not picked up and exploded in the 'assert statements'

@phax
Copy link
Owner

phax commented Feb 22, 2017

Referring to issue #17 - right?
Can you please paste an example here - thanks.

@phax phax self-assigned this Feb 22, 2017
@jonigkeit
Copy link

jonigkeit commented Feb 22, 2017

The problem is with abstract rules

Example schematron

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
    <pattern>
    		<rule abstract="true" id="ABSTRACT">
    		<let name="roat" value="'roat'"/>
    		<let name="root" value="'root'"/>
    		<let name="rootRef" value="$root"/>
    		<assert role="error" test="matches($roat,@value)">@value must be abstract $roat</assert> <!-- should fail -->
    		<assert role="error" test="matches($root,@value)">@value must be abstract $root</assert> <!-- should pass -->
    		<assert role="error" test="matches($rootRef,@value)">@value must be abstract $rootRef</assert> <!-- should pass -->
    		<assert role="error" test="matches('root',@value)">@value must be abstract root</assert> <!-- should pass -->
	    	</rule>
	    	
    		<rule context="root" id="CONCRETE">
    		<let name="roat" value="'roat'"/>
    		<let name="root" value="'root'"/>
    		<let name="rootRef" value="$root"/>
    		<assert role="error" test="matches($roat,@value)">@value must be concrete $roat</assert> <!-- should fail -->
    		<assert role="error" test="matches($root,@value)">@value must be concrete $root</assert> <!-- should pass -->
    		<assert role="error" test="matches($rootRef,@value)">@value must be concrete $rootRef</assert> <!-- should pass -->
    		<assert role="error" test="matches('root',@value)">@value must be concrete root</assert> <!-- should pass -->
	    	</rule>

	    	<rule context="root">
	    	<extends rule="ABSTRACT"/>
	    	</rule>
    </pattern>
</schema>

Example XML
<root value="root"/>

@phax phax added the bug label Feb 22, 2017
@jonigkeit
Copy link

jonigkeit commented Feb 22, 2017

Here is a simpler version

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
  <pattern>
    <rule abstract="true" id="my-abstract-rule">
      <let name="my-root-variable" value="'root'"/>
      <assert role="error" test="$my-root-variable = @value">@value must be 'root'</assert>
    </rule>
	    	
    <rule context="root">
      <extends rule="my-abstract-rule"/>
    </rule>
  </pattern>
</schema>
<root value="root"/>

@phax
Copy link
Owner

phax commented Feb 22, 2017

It's a problem with the pure implementation... working on it. <extends> is not resolved correctly

phax added a commit that referenced this issue Feb 22, 2017
@phax
Copy link
Owner

phax commented Feb 22, 2017

Now also works in "pure" version

@phax
Copy link
Owner

phax commented Feb 22, 2017

Release 4.2.2. should be on Maven central within the next hour

@phax phax closed this as completed Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants