Power Hour October 2010 Building Custom Formats Ben Allums
Power Hour – October 2010 Agenda Survey Results Building Custom Formats Concepts Code Practice Webinars of Interest
Power Hour – October 2010 Survey Results
Survey Results When to meet:
Survey Results Topics to cover:
Survey Results Topics to cover: Using the XML adapter with DTDs other than DITA Files needed to customize the WebWorks 5 template - has their location changed since the help doc on the wiki was posted? pre-2008.4
Building Custom Formats Power Hour – October 2010 Building Custom Formats
Building Custom Formats Concepts Code Practice
Building Custom Formats Concepts
Building Custom Formats Concepts Start with XML Script with XSLT Use the File Library Finding files Adding files Extension Methods, for everything else Manipulate with file & URI paths Write files Log progress
Concepts Container Nested Nested Start with XML Structured content Distinguish with attributes Container id=top Nested id=first type=aaa Nested id=sec type=aaa
Concepts Container * Container A Nested Copy Nested type=aaa A Nested Script with XSLT Match context Emit new structure or keep the same Container id=top * Container A Nested Copy Nested id=first type=aaa type=aaa A Nested A Nested id=sec type=aaa Copy
Concepts Files File File Use the File Library Finding files Adding files Files File path type File path type
Concepts * wwfilesystem Copy wwexsldoc type=aaa A wwlog Copy Extension Methods, for everything else Manipulate with file & URI paths Write files Log progress * wwfilesystem Copy wwexsldoc type=aaa A wwlog Copy
Building Custom Formats Code
Building Custom Formats Code Start with XML Script with XSLT Use the File Library Finding files Adding files Extension Methods, for everything else Manipulate with file & URI paths Write files Log progress
Code Start with XML All content (FrameMaker, Word, DITA) goes to XML WebWorks Intermediate Format (WIF) <?xml version="1.0" encoding="utf-8"?> <Document xmlns="urn:WebWorks-Document-Schema"> <Content> <Paragraph id="5000001" stylename="Heading1"> <TextRun id="5000001-1" stylename="Bold"> <Text value="Example WIF Document" /> </TextRun> <TextRun id="5000001-2"> <Text value=" shows what is possible." /> </TextRun> </Paragraph> </Content> </Document>
Code Script with XSLT Match content Emit as you like <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="wwdoc:Paragraph[@stylename = 'Heading 1']"> <h1> <xsl:apply-templates /> </h1> </xsl:template> <xsl:template match="*"> <xsl:apply-templates /> </xsl:template> ... </xsl:stylesheet> wwdoc:Paragraph[@stylename = 'Heading 1'] <h1> </h1>
Code Use the File Library Tracks every file ePublisher knows about Look for types (and also group and document IDs) <?xml version="1.0" encoding="utf-8"?> <Files version="1.0" xmlns="urn:WebWorks-Engine-Files-Schema"> <File path="C:\Temp\WebWorks\ePublisher\Data\resource.fmwif" type="engine:conversion" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4"> <Depends path="C:\Desktop\book\resource.fm" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </File> <File path="C:\Temp\WebWorks\ePublisher\Data\resource.wif" type="engine:wif" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4"> <Depends path="C:\Temp\WebWorks\ePublisher\Data\resource.fmwif" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </File> type="engine:conversion" type="engine:wif"
Code Use the File Library Finding files Query by type Process all files of a given type at once <?xml version="1.0" encoding="utf-8"?> <Files version="1.0" xmlns="urn:WebWorks-Engine-Files-Schema"> <File path="C:\Temp\WebWorks\ePublisher\Data\resource.fmwif" type="engine:conversion" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4"> <Depends path="C:\Desktop\book\resource.fm" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </File> <File path="C:\Temp\WebWorks\ePublisher\Data\resource.wif" type="engine:wif" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4"> <Depends path="C:\Temp\WebWorks\ePublisher\Data\resource.fmwif" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </File> type="engine:wif"
Code Use the File Library Adding files Tell ePublisher what you created Available to all later processing stages <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet> <xsl:template match="/"> ... <wwfiles:Files> <wwfiles:File path="C:\Desktop\my_new_file.html" type="output:page" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </wwfiles:Files> </xsl:template> ... </xsl:stylesheet> <wwfiles:Files> <wwfiles:File path="C:\Desktop\my_new_file.html" type="output:page" groupID="WS29Gkg8W7g" documentID="V-d9Aksa5_4" /> </wwfiles:Files>
Code Extension Methods, for everything else XSLT only goes so far Extension methods enable ePublisher to provide a complete solution <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet> <xsl:template match="/"> ... <xsl:variable name="VarPageAsXML"> <!-- Page content --> </xsl:variable> <xsl:variable name="VarPage" select="msxsl:node-set($VarPageAsXML)" /> <xsl:variable name="VarPath" select="wwfilesystem:Combine($VarOutputDir,'file.html')" /> <xsl:variable name="VarWriteFile" select="wwexsldoc:Document($VarPage, $VarPath)" /> ... </xsl:template> ... </xsl:stylesheet> wwfilesystem:Combine($VarOutputDir,'file.html') wwexsldoc:Document($VarPage, $VarPath)
Building Custom Formats Practice
Building Custom Formats Practice Minimal format to get started Customize an existing format Let’s try it!
Power Hour – October 2010 Webinars of Interest
Webinars of Interest Show Me: November 18th at 11:30am Central Topic: Single Sourcing your Content & ePublisher 2010.3 Learn what the ePublisher platform can do for you right out of the box. Hosted by members of the WebWorks staff Repeats on the 3rd Thursday of every month Sign-up at http://www.webworks.com/Resources/Events/Show_Me/
Webinars of Interest Study Hall: November 10th at 1:00pm Central Open forum for ePublisher users Ask questions or request help on custom projects Hosted by members of the WebWorks development staff Repeats on the 2nd and last Wednesdays of every month Join at http://www.webworks.com/Resources/Events/Study_Hall/
Webinars of Interest Archives: Power Hour http://www.webworks.com/Resources/Events/Power_Hour/Archive/ Show Me! http://www.webworks.com/Resources/Events/Show_Me/Archive/
Power Hour October 2010 Building Custom Formats Ben Allums