Schematron to find plural keywords
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Schematron to find plural keywords
Post by shudson310 »
I've found a few instances where an author has used something like .
I know this will create issues with the content is translated, or potentially if the value of the key changes.
Any suggestions on how to detect this construction? I've tried variations on substring-after, but can't get it exactly right.
Thanks!
Code: Select all
<keyword keyref="display"/>s
I know this will create issues with the content is translated, or potentially if the value of the key changes.
Any suggestions on how to detect this construction? I've tried variations on substring-after, but can't get it exactly right.
Thanks!
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: Schematron to find plural keywords
Post by shudson310 »
shudson310 wrote:I've found a few instances where an author is trying to create a plural version of an existing term, using something like:.Code: Select all
<keyword keyref="display"/>s
I know this will create issues with the content is translated, or potentially if the value of the key changes.
Any suggestions on how to detect this construction? I've tried variations on substring-after, but can't get it exactly right.
Thanks!
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Schematron to find plural keywords
Hello,
You can create a Schematron rule that matches the keyword element, and check that the text after the element does not start with the 's' character. The rule will be something like this:
Or, if you want to create a more generic rule that will check if after the keyword element is not a character that might appear in a word (so you can permit "punctuation" or "space"), you can create a rule like this:
Best Regards,
Octavian
You can create a Schematron rule that matches the keyword element, and check that the text after the element does not start with the 's' character. The rule will be something like this:
Code: Select all
<sch:rule context="keyword[@keyref]">
<sch:report test="following-sibling::node()[1][self::text()][starts-with(self::text(), 's')]">
The 's' character is not allowed after a keyword
</sch:report>
</sch:rule>
Code: Select all
<sch:rule context="keyword[@keyref]">
<sch:report test="following-sibling::node()[1][self::text()][matches(self::text(), '^\w+')]">
Text not allowed after keyword
</sch:report>
</sch:rule>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Re: Schematron to find plural keywords
Post by shudson310 »
Thanks, Octavian! The first suggestion is exactly what I needed.
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.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