[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using XSL variable in XQuery regular expression
Dear List, Is it possible to use an XSL variable in a regular expression when using the "matches" function in an XSL transformation? Say I have <xsl:variable name="Prefix" as="xs:string" select="'PR'"/> Then I want to use $Prefix in my regular expression like I might use XSL variables elsewhere: matches(normalize-space(text()[1]), '^(optional beginning text)*$Prefix: [a-zA-Z ]*') $ is a special character in regular expressions. I haven't found examples of variables in regular expressions in my internet searching. I'd like to match text that starts with 'PR', such as "PR1234: Some problem to report". I'd also like to match text that may have some other initial characters, then the 'PR' prefix and more text, such as "optional beginning text PR9876: Another problem". I could put the literal 'PR' in the regular expression, but I was hoping to factor that out for use in a few other regular expressions, and have only one place to edit if the prefix string changed. Thanks for suggestions, or letting me know this can't be done. Sincerely, Mike Cook This email and any attachments are only for use by the intended recipient(s) and may contain legally privileged, confidential, proprietary or otherwise private information. Any unauthorized use, reproduction, dissemination, distribution or other disclosure of the contents of this e-mail or its attachments is strictly prohibited. If you have received this email in error, please notify the sender immediately and delete the original.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|