469,320 Members | 2,144 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,320 developers. It's quick & easy.

Can an xsl:function return an element w/value?

Just starting to get heavy into xslt. I'm particularly interested in xslt 2.0 and the use of regular expressions, etc.
I'm trying to figure out how I can return an element from a function. My non-xml data is very unstructured (more than I will show here) but I'm trying to see
if I can transform it into xml by putting an xml tag around it. My example data looks as follow:


My goal is to have the following output:

There many way I can parse this but, for now, I'm trying to see if I can have a function return
an element with data, such as: <pet>dog<pet>. I'm having problem putting the data
in a xsl:value-of select statement; though I'm escaping the xml angle brackets. My function looks
like the following:

<xsl:function name="my:normalizedData" as="xs:anyAtomicType*">
<xsl:param name="input"/>
<xsl:variable name="out" as="xs:anyAtomicType*">

<!-- the following express should produce: pet:doj
with regexp-group(1)=pet, gegexp-group(2)=dog -->
<xsl:analyze-string select="$input" regex="(.*?):(.*?)(?=\*)">

<xsl:value-of select="

Thank you,
Feb 19 '07 #1
1 2447
839 Expert 512MB
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Mar 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Wayne Lian via .NET 247 | last post: by
1 post views Thread by Filip Hendrickx | last post: by
3 posts views Thread by bklopfen | last post: by
1 post views Thread by IanHollamby | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.