Using function from different namespace
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Mar 21, 2022 12:08 pm
Using function from different namespace
Hi,
I have a problem with this regex function for getting the ticket ID from the subject of an email
Input:
Subject: Re: [Ticket0123456789] Testmail
Expected Result: aaVendorIncidentNumber -> [Ticket0123456789]
Instead of the Matching Substring I get the hole emailbody. I suggest it has something to do with the different namespaces.
How can I edit it correctly?
Info: I don't know why but the x-path functions are not available in namespace xsl
I have a problem with this regex function for getting the ticket ID from the subject of an email
Code: Select all
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
.............................
<xsl:variable name="aaVendorIncidentNumber">
<fn:analyze-string select="$emailSubject" regex="\[Ticket\d{{10}}\]">
<fn:matching-substring>
<xsl:value-of select="."/>
</fn:matching-substring>
</fn:analyze-string>
</xsl:variable>
....................
Subject: Re: [Ticket0123456789] Testmail
Expected Result: aaVendorIncidentNumber -> [Ticket0123456789]
Instead of the Matching Substring I get the hole emailbody. I suggest it has something to do with the different namespaces.
How can I edit it correctly?
Info: I don't know why but the x-path functions are not available in namespace xsl
-
- Posts: 143
- Joined: Tue Mar 25, 2003 11:21 am
Re: Using function from different namespace
Hello,
Please consider using the following code for your implementation:
Please note that the fn:analyze-string() function returns as a result a fn:analyze-string-result element.
Regards,
Mircea.
Please consider using the following code for your implementation:
Code: Select all
<xsl:variable name="aaVendorIncidentNumber">
<xsl:value-of select="fn:analyze-string($emailSubject,'\[Ticket\d{10}\]')/fn:match"/>
</xsl:variable>
Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.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