Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL Transform of Element with Text containing Tags

From: "Marrow" <marrow@--------------------.--->
To: 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
>
>




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent