xsl-list
[Top] [All Lists]

Re: Transforming nested tags within a sentence

2005-05-24 15:33:18
Hi, David,

You're close, but it looks like you're thinking it's more complex than it 
actually is.

Try this for your para template:

<xsl:template match="para">
    <P><xsl:apply-templates/></P>
</xsl:template>

Your para node actually contains three child nodes: text, see, text. This 
template works because apply-templates picks up both the text nodes and 
the see node and processes them in their existing order.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




"David Gadd" <David(_dot_)Gadd(_at_)businessobjects(_dot_)com> 
05/24/2005 05:22 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
cc

Subject
[xsl] Transforming nested tags within a sentence






I am trying to transform nested tags within a sentence and have not found 
the solution so far.

A. THE PROBLEM:
original xml:
 
<para>For more information, go to <see cref="blahblah">Some 
Destination</see> and examine paragraph 3.</para>
desired HTML output:
<P>For more information go to <A HREF="blahblah">Some Destination</A> and 
examine paragraph 3.</P>


B. THE ATTEMPTED SOLUTION:
This doesn't work--it simply places the link as an addendum BELOW the 
paragraph.

<xsl:template match="para">
    <P><xsl:value-of select="." /></P>
                 <xsl:apply-templates select="see" />
</xsl:template>

<xsl:template match="see">
    <A HREF="{(_at_)cref}"><xsl:value-of select="." /></A>
</xsl:template>

C. OTHER EXPLORER SOLUTIONS
My search of the list archive suggests that other solutions could like in 
treating the <see> tag as a string rather than a tag, and attempting some 
form of string replacement. However, I'm thinking there should be a 
standard solution for transforming this tag, and I am just not 
understanding how this works.

Thanks very much,

David Gadd


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>