What's wrong with my quickfix?
Posted: Tue Nov 20, 2018 9:30 pm
Hi there,
I'm trying to write a Schematron Quick Fix that will tag a block of untagged text as a verse stanza in TEI, using a block of XSLT. This is what I have, based on an example from this forum:
The result is always an empty lg element, with the text deleted, so I must be missing something. Can anyone see what's broken?
All help appreciated,
Martin
I'm trying to write a Schematron Quick Fix that will tag a block of untagged text as a verse stanza in TEI, using a block of XSLT. This is what I have, based on an example from this forum:
Code: Select all
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
id="dvpp-noTextInDivOrLg-constraint-rule-15">
<sch:rule xmlns="http://www.tei-c.org/ns/1.0"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
context="tei:div/text()[matches(., '[a-z]+.*
')] | tei:lg/text()[matches(., '[a-z]+.*
')]">
<sch:assert test="text()" sqf:fix="tagBlockAsStanza">
Untagged text should probably be tagged as a stanza or a paragraph.
</sch:assert>
<sqf:fix id="tagBlockAsStanza">
<sqf:description>
<sqf:title>Tag this block as a stanza.</sqf:title>
</sqf:description>
<sqf:replace>
<tei:lg>
<xsl:analyze-string select="." regex="'
\s*[^
]+'">
<xsl:matching-substring>
<tei:l>
<xsl:value-of select="regex-group(0)"/>
</tei:l>
</xsl:matching-substring>
<xsl:non-matching-substring>
</xsl:non-matching-substring>
</xsl:analyze-string>
</tei:lg>
</sqf:replace>
</sqf:fix>
</sch:rule>
</pattern>
All help appreciated,
Martin