Altova Mailing List Archives


Re: [xsl] Required help in XSL transformation

From: David Carlisle <davidc@--------->
To:
Date: 9/7/2006 1:16:00 PM
> Any clues how to implement the same?
did you try the template I posted earlier? Why start a new thread with
an identical question?

Once again, your sample input is not well formed, and you did not post a
complete version of your required output, also it's better for the
archives if you give threads sensible subject lines. (the subject line
above could apply to any message on this list.)

I just tried the template that I posted previously and it seems to work...
You just need to fill in the replace template and templates for any
elements that you need to process by somthing other than copy.



David



<?xml version="1.0" encoding="UTF-8" ?>
<elem id="1234" date="14 Aug 2006" time="13:36">

<title>Sample Title</title>
<text>
<p>    This is some data </p>
<p>     </p>
<p>    This is some special characters &lt;AHLN.AS&gt; </p>
<p>    A group of students have gone to picnic. </p>
<p>     </p>
<PRE>    ** This is another special tag
     
 
  </PRE></text>
</elem>



<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  

  <xsl:template match="*">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
 
  <xsl:template match="p//text()">
    <xsl:call-template name="transformXMLString">
      <xsl:with-param name="StringToTransform" select="."/>
    </xsl:call-template>	
  </xsl:template>

  <xsl:template  name="transformXMLString">
   <xsl:param name="StringToTransform" select="."/>
   [replce a by b in <xsl:value-of select="."/>]
  </xsl:template>
</xsl:stylesheet>



$ saxon grumble.xml grumble.xsl
<?xml version="1.0" encoding="utf-8"?><elem id="1234" date="14 Aug 2006" time="13:36">

<title>Sample Title</title>
<text>
<p>
   [replce a by b in     This is some data ]
  </p>
<p>
   [replce a by b in      ]
  </p>
<p>
   [replce a by b in     This is some special characters &lt;AHLN.AS&gt; ]
  </p>
<p>
   [replce a by b in     A group of students have gone to picnic. ]
  </p>
<p>
   [replce a by b in      ]
  </p>
<PRE>    ** This is another special tag
     
 
  </PRE></text>
</elem>

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.