Re: WOXMLCoder XML tag output ordering issue
Re: WOXMLCoder XML tag output ordering issue
- Subject: Re: WOXMLCoder XML tag output ordering issue
- From: Deirdre Saoirse Moen <email@hidden>
- Date: Fri, 6 May 2005 19:57:42 -0700
On May 1, 2005, at 5:47 PM, Deirdre Saoirse Moen wrote:
...the 1-3-2 I can live with, but this XML is going into Adobe
inDesign, which respects the tag order. It's not a simple task to
re-order the fields in post-processing. Clearly, it makes no sense to
list a guest's biography BEFORE their name.
So, since no one had a suggestion, I simply went to XSLT for the
post-processing.
I found it easiest with a slight change in the mapping file:
<model>
<entity name="Guests" xmlTag="Guest">
<property name="bio" xmlTag="Biography"/>
<property name="guestName" xmlTag="GuestName" attribute="YES"/>
<property name="panels" xmlTag="Panel"/>
</entity>
<entity name="Panels" xmlTag="Panel">
<property name="toTimeSlots.timeSlotStartDateAM" xmlTag="Time"/>
<property name="panelTitle" xmlTag="PanelTitle"/>
<property name="roomList" xmlTag="Room"/>
</entity>
</model>
...and the following XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="Guest">
<Guest>
<GuestName>
<xsl:apply-templates select="@*"/>
</GuestName>
<xsl:text> </xsl:text>
<xsl:copy-of select="Biography"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="Panel"/>
</Guest>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="@guestName">
<xsl:attribute name="guestName">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="Panel">
<Panel>
<xsl:copy-of select="Time"/>
<xsl:text>	</xsl:text>
<xsl:copy-of select="Room"/>
<xsl:text>	</xsl:text>
<xsl:copy-of select="PanelTitle"/>
</Panel>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
Note that this doesn't encode the root element, which I just added that
by hand rather than fuss with it any further. The resulting file
imports into inDesign pretty spiffily, plus it puts the Panel elements
on one line of output with tabs in between.
--
_Deirdre http://deirdre.net
"Ideally pacing should look like the stock market for the year 1999, up
and up and up, but with lots of little dips downwards...."
-- Wen Spencer
--
_Deirdre http://deirdre.net
"Ideally pacing should look like the stock market for the year 1999, up
and up and up, but with lots of little dips downwards...."
-- Wen Spencer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden