[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: element nodes in a string?
The title explains the problem: you can't have element nodes in a string. To achieve what you're after, I think you'll have to use result tree fragments rather than strings; and because you need to process the result tree fragments, you'll need to use the node-set() extension function. > > My approach is to chain together a bunch of calls to a > standard replace-substring template: > > <!-- convert two hyphens into an em dash --> > <xsl:variable name='temp2'> > <xsl:call-template name='replace-substring'> > <xsl:with-param name='text' select='$temp1'/> > <xsl:with-param name='from' select='$dash'/> > <xsl:with-param name='to'>—</xsl:with-param> > </xsl:call-template> > </xsl:variable> > > <!-- convert tab characters into two 's --> > <xsl:variable name='temp3'> > <xsl:call-template name='replace-substring'> > <xsl:with-param name='text' select='$temp2'/> > <xsl:with-param name='from' select='$tab'/> > <xsl:with-param > name='to'>  </xsl:with-param> > </xsl:call-template> > </xsl:variable> > > I then call a template which converts _underscored > text_ into <U>underscored text</U>. This works just > fine. I also have a similar template which converts > ~text within tildes~ to <I>text within tildes</I>. > > The problem is that I can't do both of them. When I > pass the output of the underline template into the > italicize template, the <U> and </U> are stripped out > and I am left with just the <I>...</I> tags. > > I think this is because my italicize template calls > substring-before and substring-after, and these string > functions convert their arguments to strings, which > effectively strips out whatever markup I have in > place. > Correct. (If you really are a newbie, you're a fast learner). You could of course process each of the text nodes in the result tree fragment separately; the problem is that the <I>-markers may be in different text nodes. The only answer to this is to work from the outside-in: the first markers you process must be those that aren't contained in any other marker. I'm inclined to agree with other respondents who have suggested that this is the time to look for other tools in your kitbag. XSLT is designed for processing files that use XML markup, it's not very good at handling files containing non-XML markup! Mike Kay 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
|