Subject: RE: [xsl] table/matrix and xpath prob From: Américo Albuquerque <melinor@xxxxxxxx> Date: Sun, 29 Feb 2004 20:58:18 -0000 |
Hi It seems that no one have replied to this message yet So, here is a possible solution: <x:key name="words" match="word" use="concat(generate-id(parent::variant),' ',.)"/> <x:template match="variables"> <x:variable name="var" select="variable/variants/variant/word[generate-id()=generate-id(key('wo rds',concat(generate-id(parent::variant),' ',.)))]"/> <table> <tr> <td>placename</td> <x:apply-templates select="$var"/> </tr> <x:apply-templates select="document('LGWLocations.xml')/locations/location"> <x:with-param name="var" select="$var"/> </x:apply-templates> </table> </x:template> <x:template match="word"> <td><x:value-of select="."/></td> </x:template> <x:template match="location"> <x:param name="var" select="."/> <x:param name="id" select="id"/> <tr> <td><x:apply-templates select="placename"/></td> <x:apply-templates select="$var/parent::variant"> <x:with-param name="id" select="$id"/> </x:apply-templates> </tr> </x:template> <x:template match="variant"> <x:param name="id" select="0"/> <td> <x:choose> <x:when test="$id=locations/location"> <x:value-of select="$id"/> </x:when> <x:otherwise> <x:text>-</x:text> </x:otherwise> </x:choose> </td> </x:template> Regards, Americo Albuquerque -----Mensagem original----- De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Em nome de m.vanrootseler@xxxxxxxxx Enviada: terça-feira, 10 de Fevereiro de 2004 18:46 Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Assunto: [xsl] table/matrix and xpath prob I'm battling with the following problem. I have two xml-files; on one I'm doing the transformation and the other one is imported with document(). The structure of the first file is as follows: (...) I want to do a table in which all the placenames from the second file are listed, followed by columns for each variant (as many columns as there are variants) from the first file. So far so good. I want to fill the columns with cells with the location value from the first file but only where this number matches the id number from the locations list. If there's no match, the cell should remain empty. What I have so far (not working) is: (...) I can't get the xpath for the last for-each-set right. I know that I have to somehow match the location with the id from the imported file in order to get a matrix like this: placename foo oof London 1 - Tokyo - 2 etc. I'm using MSXML and IE6. Has anyone got any idea how this might be solved? Much appreciated. Mick XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] table/matrix and xpath prob, m . vanrootseler | Thread | [xsl] better way to validate XML .., Kotes Mogili |
RE: [xsl] Thinking Out loud - XML o, Jim Fuller | Date | RE: [xsl] Thinking Out loud - XML o, Karl J. Stubsjoen |
Month |