xsl-list
[Top] [All Lists]

Re: CLARIFICATION ON MY XSLT

2005-04-23 01:41:59
You might also try this.. This is a modified identity
stylesheet.. I might have missed some template rules
(I think I have).. But you may take the idea! 

Please also consider Mike's answer..

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  
  <xsl:output method="xml" indent="yes" />
  
  <xsl:template match="node() | @*">
    <xsl:copy>       
      <xsl:apply-templates select="node() | @*" />
    </xsl:copy>
  </xsl:template>  
  
  <xsl:template match="p">
    <para>
      <xsl:apply-templates />
    </para>
  </xsl:template>
   
  <xsl:template match="i">
    <render font-style="italic">
      <xsl:apply-templates />
    </render>
  </xsl:template>
  
  <xsl:template match="b/i">
    <render font-weight="bold" font-style="italic">
      <xsl:apply-templates />
    </render>
  </xsl:template>
  
  <xsl:template match="i/sub">
    <render font-style="italic" baseline-shift="sub"
font-size="smaller">
      <xsl:apply-templates />
    </render>
  </xsl:template>  
    
  <xsl:template match="b/i/inf">
    <render font-weight="bold" baseline-shift="sub"
font-size="smaller">
      <xsl:apply-templates />
    </render>
  </xsl:template>
  
  <xsl:template match="b">
    <xsl:apply-templates />
  </xsl:template>
  
  <xsl:template match="b/text()">
    <render font-weight="bold"> 
      <xsl:value-of select="." />
    </render>
  </xsl:template>  
  
</xsl:stylesheet>

Regards,
Mukul

--- Arulxml(_at_)netscape(_dot_)net wrote:
Greetings all,

I am processing XML to XML by using XSL style sheet
and Saxonb 8.0

My source XML file
<root>
<p>some text</p>
<p>some text <i>italic text</i></p>
<p>some text <b><i>bold+italic text</i> bold
text</b></p>
<p>some text <i>italic text <sub>subscript+italic
text</sub></i> some text</p>
<p>some text <b>bold text <i>Italic text</i> bold
continues <i>x<inf>2</inf></i> bold
continues</b></p>
</root> 

My resulting XML file
<root>
<para>some text</para>
<para>some text <render font-style="italic">italic
text</render></para>
<para>some text <render font-weight="bold"
font-style="italic">bold+italic text</render><render
font-weight="bold"> bold text</render></para>
<para>some text <render font-style="italic">italic
text </render><render font-style="italic"
baseline-shift="sub"
font-size="smaller">subscript+italic text</render>
some text</para>
<para>some text <render font-weight="bold">bold text
</render><render font-weight="bold"
font-style="italic">bold+Italic text</render><render
font-weight="bold"> bold continues </render><render
font-weight="bold"
font-style="italic">x</render><render
font-weight="bold" baseline-shift="sub"
font-size="smaller">2</render><render
font-weight="bold"> bold continues</render></para>
</root>

Please advise how the XSLT will be to bring the
resulting XML file. Many Many thanks in advance.

Best regards to you
Arul Kumar




__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at
http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those
annoying pop-ups.
Download now at
http://channels.netscape.com/ns/search/install.jsp


--~------------------------------------------------------------------
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!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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>