|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] using position() inside Muenchian groups?
I've got data that looks like this:
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<RESULTSET FOUND="3">
<ROW MODID="0" RECORDID="1">
<COL><DATA>1</DATA></COL>
<COL><DATA>The Alice</DATA></COL>
<COL>
<DATA>PRDC</DATA>
<DATA>EXCP</DATA>
<DATA>DRCT</DATA>
<DATA>DOPH</DATA>
<DATA>EXCP</DATA>
<DATA>PRDC</DATA>
<DATA>WRTR</DATA>
</COL>
<COL>
<DATA>Alan Jones</DATA>
<DATA>Big Cheese</DATA>
<DATA>Bill Smith</DATA>
<DATA>Camera Guy</DATA>
<DATA>Little Cheese</DATA>
<DATA>Zachary Azimuth</DATA>
<DATA>Dicky Dickens</DATA>
</COL>
<COL>
<DATA></DATA>
<DATA></DATA>
<DATA>Yes</DATA>
<DATA></DATA>
<DATA></DATA>
<DATA></DATA>
<DATA></DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="3">
<COL><DATA>3</DATA></COL>
<COL><DATA>Mini Mini</DATA></COL>
<COL>
<DATA>DRCT</DATA>
<DATA>PRDC</DATA>
<DATA>WRTR</DATA>
</COL>
<COL>
<DATA>Wal Walliams</DATA>
<DATA>Wal Walliams</DATA>
<DATA>Wal Walliams</DATA>
</COL>
<COL>
<DATA>Yes</DATA>
<DATA>Yes</DATA>
<DATA>Yes</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
There are always five columns (which for convenience I refer to by variable
names, see following), but the number of <DATA> elements in columns #3-5 can
vary per record.
<xsl:variable select="1" name="title_id" />
<xsl:variable select="2" name="title" />
<xsl:variable select="3" name="crew_role" />
<xsl:variable select="4" name="crew_name" />
<xsl:variable select="5" name="crew_flag" />
I want to produce output that looks like this:
> Title: The Alice
> Producer: Alan Jones*, Zachary Azimuth
> Director: Bill Smith
> Writer: Dicky Dickens
>
> Title: Mini Mini
> Producer: Wal Walliams*
> Director: Wal Walliams*
> Writer: Wal Walliams*
I'm thinking I could use Muenchian grouping to pull out all the PRDC
sub-fields for a record (and then all the DRCT, WRTR, etc), and I also know
how to use position() to access the corresponding sibling...
<xsl:variable name="p" select="position()"/>
<xsl:if test="$p>1"><xsl:text>, </xsl:text></xsl:if>
<xsl:value-of select="ancestor::fmp:ROW/fmp:COL[$crew_name]/fmp:DATA[$p]"/>
... but I suspect these won't play together nicely because (eg) the
position() of the second producer (PRDC) in the first title would be "2",
and not "6", and thus ancestor::fmp:ROW/fmp:COL[$crew_name]/fmp:DATA[$p]
would grab the 2nd $crew_name of *all* the siblings, not the 2nd producer's
$crew_name.
Am I right? If so, how would I go about doing this?
e.
(ps, yes, I am really starting to hate Filemaker's XML export format)
--
Ironclad Networks
Information Architecture
http://www.ironclad.com.au/
"Providing tactical IA services to web agencies"
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! 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
|

Cart








