Subject: Re: [xsl] using position() inside Muenchian groups? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 13 Oct 2008 22:18:05 -0400 |
I've got data that looks like this: ... I want to produce output that looks like this: ... 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...
<test> <x/> <x/> <x/> </test>
<xsl:template match="x"> <xsl:if test="position()>1">,</xsl:if> <xsl:value-of select="position()"/> </xsl:template>
<xsl:template match="test"> <xsl:apply-templates select="*"/> </xsl:template>
<xsl:template match="test"> <xsl:apply-templates/> </xsl:template>
<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?
(ps, yes, I am really starting to hate Filemaker's XML export format)
-- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] using position() inside Muenc, Eric Scheid | Thread | Re: [xsl] using position() inside M, Eric Scheid |
[xsl] using position() inside Muenc, Eric Scheid | Date | Re: [xsl] using position() inside M, Eric Scheid |
Month |