[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: regexs, grouping (?) and XSLT2?
On Aug 8, 2004, at 6:45 PM, Michael Kay wrote:
I think you're trying to solve several problems at the same time here. It Fair enough. Anything to get me pointed in the right direction is appreciated. Let me just see if I understand the following: Essentially both the para output and the list of citations are grouping problems that can be tackled using xsl:for-each-group, probably using group-adjacent. You may need to write a function that calculates the grouping key. The suffix "a", "b" etc can be obtained using xsl:number. It may be simplest to start by generating a copy of the bibliography in which the list of authors (Doe and Jones) and the year/serial (1999b) appear as additional computed child elements or attributes, and then working with this copy. So something like this to start? <xsl:template match="mods:modsCollection"> <xsl:for-each-group select="mods:mods" group-by="mods:name/mods:namePart[@type='family']"> <author> <xsl:attribute name="key"> <xsl:value-of select="current-grouping-key()"/> </xsl:attribute> <xsl:for-each-group select="current-group()" group-by="substring(mods:originInfo/mods:dateIssued,1,4)"> <year> <xsl:attribute name="key"> <xsl:value-of select="current-grouping-key()"/> </xsl:attribute> <xsl:copy-of select="current-group()"/> </year> </xsl:for-each-group> </author> </xsl:for-each-group> </xsl:template> This gives me output like: <author key="Jones"> <year key="1999"> <mods xmlns="http://www.loc.gov/mods/v3" ID="three"> etc. The problem is that the author key only captures the first name element. Is this why you say I may need to "write a function that calculates the grouping key"? Any further hints on how to do this? Bruce
|
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
|