Subject: [xsl] again lookup table From: Alexander.RACHER@xxxxxxxx Date: Tue, 16 May 2006 17:39:43 +0200 |
hi, i'm using xslt 1.0 with apache fop 0.92. i'm new to xslt / xsl-fo and until now everthing worked quite well, but this lookup table makes me desperate... here the xml-source dakl.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <seife> <at.sds.xc.reportService.ReportDaten> </at.sds.xc.reportService.ReportDaten> <at.sds.xc.positionsreports.DaklOutput> [...] <einzelPositionList arraySize="10"> <element> <positionsDaten> <positSaldoGilt>19998</positSaldoGilt> <positVerwahrart>WR</positVerwahrart> <positLoco>DE</positLoco> <positTyp>UPOS</positTyp> [...] </positionsDaten> <fiBezeichnungList arraySize="1"> [...] </fiBezeichnungList> </element> [9 similar elements following] here the lookup xml SVZ_1001.xml: <?xml version="1.0" encoding="ISO-8859-1" ?> - <getTables> - <at.sds.xc.coreService.CodeTableList arraySize="1"> - <element> <codeTableNo>1001</codeTableNo> <codeTableType>ALLG</codeTableType> <codeTableName>code-table-name</codeTableName> - <codes arraySize="97"> - <element> <code>0000</code> <hcode /> <sysstatus>0</sysstatus> <codeText>Wien</codeText> </element> - <element> <code>DE</code> <hcode /> <sysstatus>0</sysstatus> <codeText>Deutschland</codeText> </element> [96 similar elements following] here is part of my xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format"> <xsl:output method="xml" omit-xml-declaration="yes"/> [...] <xsl:variable name="leer"/> [...] <xsl:key name="loco-lookup" match="element" use="code"/> <xsl:variable name="loco-top" select=" document('SVZ_1001.xml')/codes"/> <xsl:template match="/"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> [page master, calling of templates defined later in stylesheet] <fo:block padding-before="1cm" font="Helvetica"> <xsl:call-template name="Posit"></ xsl:call-template> </fo:block> [...] </fo:root> </xsl:template> [definition of all templates called before] <xsl:template name="Posit"> <xsl:choose> <xsl:when test="//einzelPositionList"> <fo:table table-omit-header-at-break=" false" table-layout="fixed" border-collapse="separate" font-size="10pt" width="100%"> [table column definition, table header] <fo:table-body> <xsl:for-each select=" //einzelPositionList/element"> <xsl:if test=" ./positionsDaten/positTyp != 'UPOS'"> <fo:table-row keep-together=" always"> <fo:table-cell> [...] </fo:table-cell> <fo:table-cell> [...] </fo:table-cell> <fo:table-cell> <fo:block> <fo:block padding-before=" 3mm+10pt"><xsl:text> </xsl:text></fo:block> < xsl:choose> < xsl:when test="./positionsDaten/fiTyp='DERI'"> <fo:block font-weight="bold"> <xsl:value-of select="./positionsDaten/kurzbezeichnung"/> </fo:block> </ xsl:when> < xsl:otherwise> <fo:block font-weight="bold"> <xsl:value-of select="./positionsDaten/bezeichnung1"/> </fo:block> </ xsl:otherwise> </ xsl:choose> < xsl:choose> < xsl:when test="./positionsDaten/fiTyp != 'DERI'"> <fo:block> <xsl:value-of select="./positionsDaten/bezeichnung2"/> </fo:block> </ xsl:when> </ xsl:choose> <fo:block> < xsl:if test="normalize-space(./positionsDaten/lfdKupon) != $leer">Kup. < xsl:value-of select="./positionsDaten/lfdKupon"/> <xsl:text> </xsl:text> </ xsl:if> < xsl:if test="normalize-space(./positionsDaten/zahlungsrhythmus) != $leer and normalize-space(./positionsDaten/endfaelligkeit) != $leer"> < xsl:text> / </xsl:text><xsl:value-of select=" ./positionsDaten/zahlungsrhythmus"/> < xsl:text> bis </xsl:text><xsl:value-of select=" ./positionsDaten/endfaelligkeit"/> </xsl:if> </fo:block > <xsl:template match="positionsDaten"> < xsl:apply-templates select="$loco-top"> < xsl:with-param name="curr-positionsDaten" select="."/> </ xsl:apply-templates> </xsl:template> <xsl:template match="codes"> <xsl:param name="curr-positionsDaten"/> < xsl:value-of select=" key('loco-lookup',$curr-positionsDaten/positLoco)/codeText"/> </xsl:template> </fo:block> </fo:table-cell> [...] when trying to transform my xml, fop says 'xsl:template ist an dieser Position der Formatvorlage nicht zuldssig' (xsl:template is not allowed at this postion). i tried several approaches (also with help from the list) to resolve my lookup table, but until now none worked. all i need is to extract the value of <codeText> in my lookup xml where <code> equals <positLoco> of my source xml... looks simple, but is tougher than i thought... any suggestions? THX alex ______________________________________________________________________ Der Austausch von Nachrichten mit Software Daten Service via E-Mail dient ausschliesslich Informationszwecken. Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht ausgetauscht werden. Correspondence with Software Daten Service via e-mail is only for information purposes. This medium is not to be used for the exchange of legally-binding communications.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] two transformations conse, Michael Kay | Thread | Re: [xsl] again lookup table, David Carlisle |
Re: [xsl] two transformations conse, David Carlisle | Date | [xsl] Add an element that contains , Gianluca Garbellotto |
Month |