xsl-list
[Top] [All Lists]

Re: [xsl] Required help in XSL transformation

2006-09-07 06:16:18

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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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