[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: searching and replacing
Thank you all for your reply.... 2. are trying to produce an exact copy of your input. That is, <sub>foo</sub> in becomes <sub>foo</sub> out; Not true. I don't have <sub> as a node in the document. What I have is & lt; sup & gt; (separated with a space to avoid the email system to convert it to <sub>). The xslt is not treating that as a <sub> node. This is why I did what I did. I am sure there might be a better way to do it. If so, pls point me to the write link? Thank you 4. think there are 'address' elements in your source tree, when there are in fact none; This was a typo. I was testing something else and did a copy and past of a wrong one. <xsl:template match="document//*"> <xsl:call-template name="supsubstring"> <xsl:with-param name="Text" select="."/> </xsl:call-template> </xsl:template> is what I intended to send. I AM REATTACHING THE FILES WITH some changes. ('& lt; sub & gt;' space is intentional) Thanks <!-- XML file --> <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type='text/xsl' href='test.xsl'?> <document id="test"> <chapter> <name>Testing sup/sub</name> <name>test superscript & lt; sup & gt; L & lt; /sup & gt; ***</name> <name>testing agian & lt; sup & gt;L & lt;/sup & gt; AFTER ***</name> <line1> <line2> <line3> testing lines subscript & lt; sub & gt; & lt; /sub & gt; *** </line3> </line2> </line1> <name>last one & lt; sub & gt; L & lt; / sub & gt; AFTER***</name> </chapter> </document> <!-- XSL file --> <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <!-- SUBSCRITPT --> <xsl:template name="supsubstring"> <xsl:param name="Text"/> <xsl:choose> <xsl:when test="contains($Text, '& lt; sub & gt;')"> <xsl:value-of select="substring-before($Text, '& lt; sub & gt;')" /> <xsl:variable name="stringaftersub" select="substring-after($Text, '& lt; sub & gt;')" /> <sub> <xsl:value-of select="substring-before($stringaftersub, '& lt; /sub & gt;')" /> </sub> <xsl:value-of select="substring-after($stringaftersub, '& lt; /sub & gt;')" /> </xsl:when> <!-- SUPERSCRIPT --> <xsl:when test="contains($Text, '& lt; sup & gt;')"> <xsl:value-of select="substring-before($Text, '& lt; sup & gt;')" /> <xsl:variable name="stringaftersup" select="substring-after($Text, '& lt; sup & gt;')" /> <sup> <xsl:value-of select="substring-before($stringaftersup, '& lt; /sup & gt;')" /> </sup> <xsl:value-of select="substring-after($stringaftersup, '& lt; /sup & gt;')" /> </xsl:when> <xsl:otherwise><xsl:value-of select="$Text" /></xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="address//*"> <xsl:call-template name="supsubstring"> <xsl:with-param name="Text" select="."/> </xsl:call-template> </xsl:template> </xsl:stylesheet> __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|