XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mark BaridSubject: DocBook
Author: Mark Barid
Date: 03 Nov 2009 03:24 PM
I have the following XML containing a presentation type structure.

(I am basically building an XSLT for converting wordProcessingML to DocBook.)

<document>
<p>A paragraph</p>
<p style='BulletedList'>A list item</p>
<p style='BulletedList'>A list item</p>
<p style='BulletedList'>A list item</p>
<p>A paragraph</p>
</document>

That needs to be converted into a structured document (DocBook).

<document>
<p>A paragraph</p>
<itemizedList>
<listitem>A list item</listitem>
<listitem>A list item</listitem>
<listitem>A list item</listitem>
</itemizedList>
<p>A paragraph</p>
</document>


UnknownNoname(47).

Postnext
(Deleted User) Subject: DocBook
Author: (Deleted User)
Date: 09 Nov 2009 12:25 PM
Hi,
which version of Stylus Studio are you using, and which processor have you selected in the Scenario Dialog?

Alberto

Postnext
Mark BairdSubject: DocBook
Author: Mark Baird
Date: 09 Nov 2009 12:41 PM
Originally Posted: 09 Nov 2009 12:34 PM
I am using Stylus Studio 2007 XML Enterprise Release 2 Installation ID: XXXXXXXX-YYYYYYYYY

Postnext
(Deleted User) Subject: DocBook
Author: (Deleted User)
Date: 09 Nov 2009 01:16 PM
Hi Mark,
you didn't say if you were using a XSLT 2.0 processor, so I wrote this XSLT 1.0 stylesheet that, albeit being less clear, should do the job for you.

Alberto


DocumentwordML2docbook.xsl
Stylesheet

Postnext
Mark BairdSubject: DocBook
Author: Mark Baird
Date: 09 Nov 2009 01:46 PM
Sorry, I should have been more clear. Unfortunately my document is far more complex as I have nested elements that the paragraph are children of.

If you look at the attached wordProcessingML I need to convert this to the following merrillDoc which is an extended version of DocBook.

"wx:sect" to a "division"
"wx:sub-section" to "section"
"w:p" to "para"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<document>
<division>
<section>
<head>Section 1</head>
<itemizedlist>
<listitem>List Item 1</listitem>
<listitem>List Item 2</listitem>
<listitem>List Item 3</listitem>
</itemizedlist>
<section>
<head>Section 1.1</head>
<para>
<emphasis variant="1">This is a </emphasis>This is a <emphasis variant="3">paragraph</emphasis>paragraph<emphasis variant="1"> with</emphasis> with a placholder $<placeholder type="numberspace"/>
</para>
<itemizedlist>
<listitem>List Item 1</listitem>
<listitem>List Item 2</listitem>
<listitem>List Item 3</listitem>
</itemizedlist>
</section>
</section>
<section>
<head/>
</section>
</division>
<division>
<section>
<head>Section 2</head>
<para>Paragraph</para>
<itemizedlist>
<listitem>List Item 1</listitem>
<listitem>List Item 2</listitem>
<listitem>List Item 3</listitem>
</itemizedlist>
<section>
<head>Section 2.1</head>
<para>This is a paragraph</para>
<itemizedlist>
<listitem>List Item 1</listitem>
<listitem>List Item 2</listitem>
<listitem>List Item 3</listitem>
</itemizedlist>
</section>
</section>
</division>
</document>


UnknownwordML.xml
wordProcessingML

UnknownmerrillDOc.xml
merrillDoc

Postnext
Mark BairdSubject: DocBook
Author: Mark Baird
Date: 09 Nov 2009 01:49 PM
All I need is the direction for the type of pattern that I need to use for the style sheet.

Postnext
Mark BairdSubject: DocBook
Author: Mark Baird
Date: 09 Nov 2009 02:07 PM
All I need is the direction for the type of pattern that I need to use for the style sheet.

Postnext
(Deleted User) Subject: DocBook
Author: (Deleted User)
Date: 11 Nov 2009 12:20 PM
Hi Mark,
the XML you have posted now is very different from the first one (and not only for its complexity, also for the different attribute values)!
However, here is starting point for you: the stylesheet has a bunch of templates, each one dealing with the translation of a single element.

Hope this helps,
Alberto


DocumentwordML2docbook(1).xsl

Posttop
Mark BairdSubject: DocBook
Author: Mark Baird
Date: 18 Nov 2009 02:33 PM
That worked great. You solved my problem and I learned a few new things with XSLT. Thank you. I did not want to finish this transform in C# using the XMLReader and XMLWriter.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.