![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL Transform of Element with Text containing Tags [Thread Next] Re: XSL Transform of Element with Text containing TagsTo: NULL Date: 7/1/2004 9:26:00 AM Hi Tyler,
Try applying templates to the <Description> child nodes and catching the
<Keyword> in a template, something like...
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="MyXMLDoc/*"/>
</body>
</html>
</xsl:template>
<xsl:template match="Description">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Keyword">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
</xsl:stylesheet>
HTH
Marrow
"Tyler" <tyler@w...> wrote in message
news:uxHZiTuXEHA.312@T......
> I would like to know whether it is possible to do the following in using
an
> XSL transform. I am currently using an XSL transform to convert an XML
> document into HTML. One of the XML tags is a generic description tag. I
> would like to enable the user to highlight keywords in the generic
> description so that I can perform certain actions with those keywords
> (highlight in bold, make a link, etc.). I have seen other postings where
> people have embedded HTML elements into the XML, but I would prefer not to
> do that and to keep the HTML in my transform (it would also enable me to
> create an index of keywords, etc.).
>
> For example, if my XML document is:
> <?xml version="1.0"?>
> <MyXMLDoc>
> <Description>This is my sentence that contains the
> <Keyword>Blue</Keyword> and <Keyword>Red</Keyword> keywords</Description>
> </MyXMLDoc>
>
> What transform can I apply to get the sentence in the correct order with
the
> keywords highlighted in bold. The following template just gets me the
text,
> but I loose the <Keyword> tags and I don't know how to get them
highlighted
> in bold:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="/MyXMLDoc/Description">
> <xsl:value-of select="."/>
> </xsl:template>
> </xsl:stylesheet>
>
> Thanks, Tyler
>
>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
