xsl-list
[Top] [All Lists]

Re: replacing parts of a string

2004-01-15 12:37:30

"Jonny Pony" <jonnypony666(_at_)hotmail(_dot_)com> wrote in message
news:Law14-F89Gad6bd89m000009edc(_at_)hotmail(_dot_)com(_dot_)(_dot_)(_dot_)
Hi,

OK. Downloaded your files. Did the things you said.
Now call me dumb:
I don't know how to invoke your "template".

Let's say I have:
<hello>

<LongString>12rt,dsfg,dsfg,ewrt,wert,xcvbs,rwete,ehgfh,xxxxxasd,awersdf,dfgx
vxcv</LongString>

<LongString>76rt,dsfg,dsfg,ewrt,wert,xcvbs,rwete,ehgfh,xxxxxasd,awersdf,dfgx
vxcv</LongString>

<LongString>wert,ds4,dsfg,ewrt,wert,xcvbs,rwete,ehgfh,xxxxxasd,awersdf,dfgxv
xcv</LongString>

<LongString>wert,d12,dsfg,ewrt,wert,xcvbs,rwete,ehgfh,xxxxxasd,awersdf,dfgxv
xcv</LongString>
</hello>

What would I "do" in my xsl to invoke your "function"?
Sorry, but I have no clue.

Answer: Nothing. Just run the transformation. The result is:

<LongString> 12rt,  dsfg,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
<LongString> 76rt,  dsfg,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
<LongString> wert,  ds4,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
<LongString> wert,  d12,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>

If you want to copy all other nodes (unchanged) just put the identity rule
as the first template in the stylesheet:

   <xsl:template match="@*|node()">
     <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
   </xsl:template>

Now the output is:

<hello>
  <LongString> 12rt,  dsfg,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
  <LongString> 76rt,  dsfg,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
  <LongString> wert,  ds4,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
  <LongString> wert,  d12,  dsfg,  ewrt,  wert,  xcvbs,  rwete,  ehgfh,
xxxxxasd,  awersdf,  dfgxvxcv</LongString>
</hello>


Dimitre Novatchev.
FXSL developer,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>