|
[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
> Here is one of the templates I have tried. With this one, I get the > original source : Are you sure? I just tried it and the source is modified by the <xsl:template match="w:p/w:pPr/w:pStyle[@w:val = 'NL']"> <xsl:copy-of select="ancestor::w:p/node()"/> <xsl:apply-templates/> </xsl:template> as I'd have expected. Unfortunately you over-clipped your input file so it wasn't well formed, so I'll post a well formed version so that you can see the result: <x xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"> <w:p> <w:pPr> <w:pStyle w:val="A-Head"/> </w:pPr> <w:r> <w:t>Nouns</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="NL"/> </w:pPr> <w:r> <w:t>blah blah blah</w:t> </w:r> </w:p> </x> Using the stylesheet exactly as you posted I get the following $ saxon wp.xml wp.xsl <?xml version="1.0" encoding="utf-8"?><x xmlns:w="http://schemas.microsoft.com/o ffice/word/2003/wordml"> <w:p> <w:pPr> <w:pStyle w:val="A-Head"/> </w:pPr> <w:r> <w:t>Nouns</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pPr> <w:pStyle w:val="NL"/> </w:pPr> <w:r> <w:t>blah blah blah</w:t> </w:r> </w:pPr> <w:r> <w:t>blah blah blah</w:t> </w:r> </w:p> </x> Note that this isn't the same as the input, "blah blah blah" is repeated, and you have a w:pPr and w:r inside the second w:pPr. this is because This matched your NL w:pStyle element <xsl:template match="w:p/w:pPr/w:pStyle[@w:val = 'NL']"> This copied all the children of the ancestor w:p, which in this case is a w:pPr element and a w:r element <xsl:copy-of select="ancestor::w:p/node()"/> This did nothing as it applies templates to the children of pStyle, but there are none. <xsl:apply-templates/> </xsl:template> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
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! Subscribe in XML format
|







