[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: selecting w:p nodes based on w:pStyle attributes

Subject: Re: selecting w:p nodes based on w:pStyle attributes
From: Terry Ofner <tofner@xxxxxxxxxxx>
Date: Tue, 28 Mar 2006 11:09:50 -0500
xmlns w
Ken, David, Jon:

Thanks for the responses. Your suggestions have helped a great deal. I have also learned that transforming WordML documents is not for the faint of heart!


To clarify, yes, I am trying to copy w:p nodes to the result tree. There are many paragraph styles in these particular Word documents and I only need to copy the w:p contents of a handful of them. I have taken Jon's suggestion to suppress the output of certain styled paragraphs using multiple lines such as this one:


<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'TAUnderscore']"/>

I then use copy-of select to write the w;p nodes of selected styled paragraphs to the result tree. This all works fine with certain xslt processors. For example xsltproc on my Mac gives solid results. Exchanger Lite using both Saxon and Xalan produces namespace calls, as in this snippet from the result tree. What's that all about?


<w:p xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:st1="urn:schemas-microsoft-com:office:smarttags">
<w:pPr>
<w:pStyle w:val="NL"/>
<w:spacing w:before="40"/></w:pPr>
<w:r><w:t> </w:t></w:r><w:r><w:rPr><w:spacing w:val="30"/></w:rPr>
<w:t>7</w:t></w:r><w:r><w:t>.</w:t>
</w:r><w:r><w:tab wx:wTab="210" wx:tlc="none" wx:cTlc="3"/>
<w:t>Pollen clings to the hair on the body of the insect. </w:t></w:r></w:p>






Here is my current stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    	xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
    	xmlns:o="urn:schemas-microsoft.com:office:office">
    	xmlns:aml="http://schemas.microsoft.com/aml2001/core">

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

<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'TAUnderscore']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'Text']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'TeachersAnnos']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'Textwindent']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'ExampleTableHead']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'ExampleText']"/>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'NLUnderscore']"/>

     <xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'A-Head']">
   <xsl:copy-of select="."/>
   </xsl:template>

   <xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'NL']">
   <xsl:copy-of select="."/>
    </xsl:template>

     <xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'Directions']">
   <xsl:copy-of select="."/>
  </xsl:template>
 </xsl:stylesheet>


Best regards,


Terry

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.