jmc430
asked on
Extract the last word in an element tag XSLT
Greetings!
Is it possible to extract the last word in an element tag?
For example:
<TEXT> This is making me rip my hair out. </TEXT>
Is there a way to just get the last word, "out" out?
I tried using the following, without success.
<xsl:param name="last" select="($arg/*[position() = last()])"/>
Any advice or guidance is greatly appreciated.
Best regards,
Jamie
Is it possible to extract the last word in an element tag?
For example:
<TEXT> This is making me rip my hair out. </TEXT>
Is there a way to just get the last word, "out" out?
I tried using the following, without success.
<xsl:param name="last" select="($arg/*[position()
Any advice or guidance is greatly appreciated.
Best regards,
Jamie
ASKER
Thanks Geert!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Jamie,
in order for the recursive template to work,
I add a normalize-space in the first call to the template
the reason is that otherwise there is a trailing space (possibly)
that breaks the test
in the otherwise, you can call your remove trailing dot template to remove the '.' after the out
cheers
Geert
in order for the recursive template to work,
I add a normalize-space in the first call to the template
the reason is that otherwise there is a trailing space (possibly)
that breaks the test
in the otherwise, you can call your remove trailing dot template to remove the '.' after the out
cheers
Geert
ASKER
Thanks so much Geert! You're totally awesome
ASKER
:)!
you are welcome
"last" would only work for elements,
not for words seperated by spaces
you need to process the string recursively,
I will post an example in a minute
Cheers!