File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xslt String replace with node

 
Sharon whipple
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to format Strings (like Java formatter) using xslt
so the outoput will be replaced with the matching {X} in the string of the data section
for example xml :



the desired output will be:

No param
Hallo world Steve and Hi roman
Hallo bla bla world roman and Hi vss

I am able to replace just normal strings with a tamplate, but i am unable to replace regular expressions

sample xsl:



Is it possible to contain function to get regex?
Thank you
 
Paul Clapham
Sheriff
Pie
Posts: 20170
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what happens instead? You get those nodes, unchanged, in your output?

Are you using a transformer which can handle XSLT 2.0?
 
Sharon whipple
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
So what happens instead? You get those nodes, unchanged, in your output?

I am able to replace Strings and i get the correct output for string replacemant, but i cannot find "{[0-9]}" as regex.
for example, in the attached xsl if you replace the line:
<xsl:variable name="regExp" select="'{[1-9]}'"/>
with :
<xsl:variable name="regExp" select="'ReplaceMe'"/>

all "ReplaceMe" word in the input will be replaced.

Are you using a transformer which can handle XSLT 2.0?
Yes.

[ November 23, 2008: Message edited by: Sharon whipple ]
 
Carey Evans
Ranch Hand
Posts: 225
Debian Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sharon. The contains and substring- functions don't use regular expressions. You'll need to use the matches and replace functions, or xsl:analyze-string and its related instructions.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic