How to get the path last element using xslt
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 12
- Joined: Thu Sep 09, 2021 12:03 pm
How to get the path last element using xslt
Hi,
I have a param in xslt . For Example, <xsl:param name="filePath"/>
The filepath is something like C:\xml\inwork\bookmap\preview\lessonName
I need to print exactly the lessonName in the attribute value.
I tried using <substring-after($filePath, '/')[last[])"/>
and <substring-after((tokenize($filePath, '/')[last[])"/> , but it is not working
Any possible solutions?
I have a param in xslt . For Example, <xsl:param name="filePath"/>
The filepath is something like C:\xml\inwork\bookmap\preview\lessonName
I need to print exactly the lessonName in the attribute value.
I tried using <substring-after($filePath, '/')[last[])"/>
and <substring-after((tokenize($filePath, '/')[last[])"/> , but it is not working
Any possible solutions?
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to get the path last element using xslt
Hi,
Also use the XSLT tokenize function as "substring-after" returns the first occurrence of the match.
Something like:
Regards,
Radu
Also use the XSLT tokenize function as "substring-after" returns the first occurrence of the match.
Something like:
Code: Select all
<xsl:value-of select="tokenize($filePath, '\\')[last()]"/>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
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