xsl-list
[Top] [All Lists]

[xsl] wordml to xml (formatting) using loop

2013-03-15 02:18:05
Hi Team,
Anybody who have an idea to handle it in the best way. I don't have any
idea, how to handling it using loop in xslt 2.0. Right now I am getting
duplicate texts

Input
  <w:r>
    <w:rPr>
      <w:b/>
      <w:i/>
      <w:u/>
    </w:rPr>
    <w:t>bold italics underline text</w:t>
  </w:r>
Output should be: <b><i><u>bold italics underline text</u></i></b>

  <w:r>
    <w:rPr>
      <w:i/>
      <w:b/>
      <w:u/>
    </w:rPr>
    <w:t>italics bold  underline text</w:t>
  </w:r>

Output should be: <i><b><u>italics bold  underline text</u></b></i>

XLSLT
<!--Text run container-->
 <xsl:template match="w:r">
  <xsl:choose>
   <xsl:when
test="w:rPr/w:vertAlign|w:rPr/w:u|w:rPr/w:b|w:rPr/w:i|w:rPr/w:smallCaps|w:rP
r/w:highlight">
    <xsl:apply-templates select="w:rPr" mode="styling"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:apply-templates/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

 <!--Text run properties container-->
 <xsl:template match="w:rPr" mode="styling">
  <xsl:for-each select="w:vertAlign|w:u|w:b|w:i|w:smallCaps|w:highlight">
   <xsl:element name="{local-name()}">
     <xsl:apply-templates select="../../w:t"/>
    </xsl:element>
  </xsl:for-each>
 </xsl:template>




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