Subject: [xsl] Lookup without document('') function From: David Carver <d_a_carver@xxxxxxxxx> Date: Fri, 7 Nov 2003 12:37:24 -0800 (PST) |
I'm currently using an XSLT parser that unfortunately doesn't support the document() function (it's still alpha software), ideally I'd switch to one of the other full feature ones, but don't know of an XSLT parser that is fully functional that is supported in Active State Perl. Anyway, here is the XSLT that I know works if I the parser supported the document() function, what I need is work around that doesn't use the document() function. If I can get the data into a Nodeset, I'm set, just can't figure out how to get the lookup data there. XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lookup="urn:some.urn" exclude-result-prefixes="lookup"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <lookup:table> <BMTABLE>CMSCASE</BMTABLE> <BMTABLE>CLAIMANT</BMTABLE> <BMTABLE>CLMREP</BMTABLE> <BMTABLE>CMSGROUP</BMTABLE> <BMTABLE>EMPLOYER</BMTABLE> <BMTABLE>EMPREP</BMTABLE> <BMTABLE>HEARING</BMTABLE> <BMTABLE>HEAROFFCR</BMTABLE> <BMTABLE>OTHERCPT</BMTABLE> <BMTABLE>SUBPOENA</BMTABLE> </lookup:table> <xsl:variable name="globalTableNames" select="document('')/*/lookup:table/*"/> <xsl:template match="DGS"> <xsl:element name="DGS"> <xsl:apply-templates select="BOOKMARKS" /> </xsl:element> </xsl:template> <xsl:template match="BOOKMARKS"> <xsl:element name="BOOKMARKS"> <xsl:for-each select="$globalTableNames"> <xsl:element name="TABLE"> <xsl:attribute name="tableid"><xsl:value-of select="."/></xsl:attribute> <xsl:variable name="tablename" select="."/> <xsl:apply-templates select="/DGS/BOOKMARKS/TABLEID[BMTABLE= $tablename]"/> </xsl:element> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template match="TABLEID"> <xsl:element name="FIELD"> <xsl:attribute name="fieldid"> <xsl:value-of select="BMFIELD"/> </xsl:attribute> <xsl:element name="DESC"> <xsl:value-of select="BMDESC"/> </xsl:element> <xsl:element name="XSLTEMP"> <xsl:value-of select="XSLTEMP"/> </xsl:element> </xsl:element> </xsl:template> </xsl:stylesheet> Sample XML Data: <DGS> <BOOKMARKS> <TABLEID> <BMTABLE>CLAIMANT</BMTABLE> <BMDESC>Address 1</BMDESC> <BMFIELD>ADDRESS1</BMFIELD> </TABLEID> <TABLEID> <BMTABLE>CLAIMANT</BMTABLE> <BMDESC>Address 2</BMDESC> <BMFIELD>ADDRESS2</BMFIELD> </TABLEID> <TABLEID> <BMTABLE>CLAIMANT</BMTABLE> <BMDESC>ANUMBER</BMDESC> <BMFIELD>ANUMBER</BMFIELD> </TABLEID> <TABLEID> <BMTABLE>CLMREP</BMTABLE> <BMDESC>FAX number</BMDESC> <BMFIELD>FAXNUMBER</BMFIELD> </TABLEID> <TABLEID> <BMTABLE>CLMREP</BMTABLE> <BMDESC>Email address</BMDESC> <BMFIELD>EMAILADDR</BMFIELD> </TABLEID> </BOOKMARKS> </DGS> ===== "...there is nothing stranger than people." - Anonymous XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] maximum depth of nested t, bryan . s . schnabel | Thread | Re: [xsl] Lookup without document(', Wendell Piez |
[xsl] maximum depth of nested tags , Andy Verbunt | Date | Re: [xsl] Passing DTD as systemID i, J.Pietschmann |
Month |