xsl-list
[Top] [All Lists]

RE: Handling mixed content elements

2005-05-06 02:12:53
By the way, I don't know if my second response made it to the list, but if
you're out there, Bill, thanks for the reply.


Respectfully,

ASP

-----Original Message-----
From: aspsa [mailto:aspsa(_at_)optonline(_dot_)net]
Sent: Friday, May 06, 2005 4:02 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Handling mixed content elements


Interesting...

If I understand you correctly, you've utilized an identity template. Very
cool. Unfortunately, and I did not specify this in my original post, the
structure of the XML document is about half narrative-like and half
data-like. The identity template would be too broad to address it.

Still, that was interesting. Thanks for the feedback.


Respectfully,

ASP

-----Original Message-----
From: Mukul Gandhi [mailto:mukul_gandhi(_at_)yahoo(_dot_)com]
Sent: Friday, May 06, 2005 3:32 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Handling mixed content elements


Please try this XSL.. (I am assuming, you wish to
generate HTML)

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:output method="html" indent="yes" />

<xsl:template match="/">
   <html>
     <head>
       <title/>
     </head>
     <body>
       <xsl:apply-templates />
     </body>
   </html>
</xsl:template>

<xsl:template match="node() | @*">
   <xsl:copy>
     <xsl:apply-templates select="node() | @*" />
   </xsl:copy>
</xsl:template>

<xsl:template match="paragraph">
   <p>
     <xsl:apply-templates />
   </p>
</xsl:template>

<xsl:template match="bold">
   <span style="font-weight: bold">
     <xsl:apply-templates />
   </span>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

--- aspsa <aspsa(_at_)optonline(_dot_)net> wrote:
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




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





__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

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




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