Altova Mailing List Archives


[xsl] Handling mixed content elements

From: aspsa <aspsa@------------->
To:
Date: 5/6/2005 6:46:00 AM
Hi, folks.

In the XML snippet below...

<paragraph>
  <bold>Actel</bold>
  (Sunnyvale, CA) will showcase its third-generation flash-based FPGA
device, ProASIC3 (see <italic>page 105</italic>)said to be the industry's
lowest-cost FPGA, starting at $1.50. The company's Libero integrated design
environment and broad IP offerings will also be on exhibit. Free workshops
and demonstrations will be offered throughout the show. (Booth #920,
http://info.edu/47)
  </paragraph>

...I applied the following template...

<xsl:template match="paragraph">
  <p>
    <xsl:if test="bold">
      <span style="font-weight: bold"><xsl:value-of select="bold" /></span>
    </xsl:if>
    <xsl:if test="italic">
      <span style="font-style: italic"><xsl:value-of select="italic"
/></span>
    </xsl:if>
    <xsl:if test="text()">
      <xsl:value-of select="text()" />
    </xsl:if>
  </p>
</xsl:template>

...for which I received the following result...

<p>
  <span style="font-weight: bold">Actel </span><span style="font-style:
italic">page 105</span>(Sunnyvale, CA) will showcase its third-generation
flash-based FPGA device, ProASIC3 (see
</p>


In the source XML document, each paragraph may contain any number of <bold>
and <italic> tags in any order. How can I modify the "paragraph" template to
account for this?

Thanks for your feedback.


Respectfully,

ASP

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.