[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Lookup without document('') function

Subject: Lookup without document('') function
From: David Carver <d_a_carver@xxxxxxxxx>
Date: Fri, 7 Nov 2003 12:37:24 -0800 (PST)
david carver
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.