Representing all alphabets in a string
Post here questions and problems related to editing and publishing DITA content.
			- 
				Raga Mounika
 - Posts: 49
 - Joined: Mon Mar 28, 2016 3:54 pm
 
Representing all alphabets in a string
Post by Raga Mounika »
Hi Team,
I have to write a schematron rule in XSLT 1.0 to represent all the lower case alphabets and digits in a single string.
I used the below code and it is not working.
contains($text, '^[a-z0-9]+$')
  
Please help me in solving this issue.
Thank you!
Regards,
Mounika
			
			
									
									
						I have to write a schematron rule in XSLT 1.0 to represent all the lower case alphabets and digits in a single string.
I used the below code and it is not working.
contains($text, '^[a-z0-9]+$')
Please help me in solving this issue.
Thank you!
Regards,
Mounika
- 
				tavy
 - Posts: 396
 - Joined: Thu Jul 01, 2004 12:29 pm
 
Re: Representing all alphabets in a string
Hello,
Because you are using Schematron with XSLT 1.0, you cannot apply a regular expressions to match a string.
A solution for XSLT 1.0 to check is if lower case alphabets and digits are used in a text is to use the translate(). Something like in the following example:
Best Regards,
Octavian
			
			
									
									Because you are using Schematron with XSLT 1.0, you cannot apply a regular expressions to match a string.
A solution for XSLT 1.0 to check is if lower case alphabets and digits are used in a text is to use the translate(). Something like in the following example:
Code: Select all
<sch:let name="vLower" value="'abcdefghijklmnopqrstuvwxyz'"/>
<sch:let name="vDigits" value="'0123456789'"/>
<sch:let name="vAlpha" value="concat($vLower, $vDigits)"/>
<sch:assert test="translate($text,$vAlpha,'') = ''">Message...</sch:assert>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
						<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ 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