Subject: Re: [xsl] wordml to xml with pStyle as tags From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 24 Mar 2006 14:18:17 -0500 |
I would like to take the pStyle attribute; convert it into an element tag and surround the w:t text with the tags.
Here is an example of a wordml snippet: ...(copied below)... I would like to get output something like this:
<A-Head>Nouns</A-Head>
<Textwindent>A dictionary lists thousands of words. All these words can be divided into eight groups called the parts of speech. A word's part of speech is determined by the job it does in a sentence.</Textwindent>
T:\ftemp>type ofner.xml <w:body xmlns:w="urn:x-this" xmlns:wx="urn:x-that"> <wx:sect> <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="Textwindent"/> </w:pPr> <w:r> <w:t>A dictionary lists thousands of words. All these words can be divided into eight groups called the parts of speech. A word's part of speech is determined by the job it does in a sentence.</w:t> </w:r> </w:p> </wx:sect> </w:body> T:\ftemp>xslt ofner.xml ofner.xsl con <?xml version="1.0" encoding="utf-8"?>
<A-Head>Nouns</A-Head> <Textwindent>A dictionary lists thousands of words. All these words can be divided into eight groups called the parts of speech. A word's part of speech is determined by the job it does in a sentence.</Textwindent>
T:\ftemp>type ofner.xsl <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="urn:x-this" xmlns:wx="urn:x-that" version="1.0">
<xsl:template match="w:p"> <xsl:element name="{w:pPr/w:pStyle/@w:val}"> <xsl:apply-templates select="w:r/w:t/node()"/> </xsl:element> </xsl:template>
</xsl:stylesheet> T:\ftemp>
-- Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-06-12/16 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] wordml to xml with pStyle as , Terry Ofner | Thread | Re: [xsl] Conditional statements in, David Carlisle |
[xsl] Muenchian grouping and summin, Belcher, Aziza | Date | RE: [xsl] Target Namespace in XML b, Michael Kay |
Month |