Subject: Using a variable to check to see if that element exists in another xml doc. From: menkell@xxxxxxxxxx Date: Mon, 7 Feb 2000 15:52:22 -0600 |
I am trying to use the variable myKey to check to see if it's value (ie. "currencyCode") is an element in another document. I am having some problems. does anyone know what is wrong with this xsl. I get the following error: XSL Error: pattern = 'document('en_US.xml')/locale/$myKey' Extra illegal tokens: 'myKey', style tree node: org.apache.xalan.xslt.ElemIf@206 d161 XSL Error: Could not parse new_currency.xsl document!, Location file:/C:/javaone /new_currency.xsl, line 11, offset 55 XSL Error: SAX Exception, Location file:/C:/javaone/new_currency.xsl, line 11, o ffset 55 pattern = 'document('en_US.xml')/locale/$myKey' Extra illegal tokens: 'myKey' at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1443) at org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl .java:673) at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:507) at transform.main(transform.java:54) Here is my xsl template:: <xsl:template match="object"> <xsl:for-each select="property"> <xsl:variable name="myKey" select="key"/> <xsl:if test="$myKey='currencyCode'"> This works; try the next if <xsl:if test="document('en_US.xml')/locale/$myKey"> insert label </xsl:if> </xsl:if> </xsl:for-each> </xsl:template> Here is my en_US.xml: <locale> <currencyCode>Currency Code</currencyCode> <fraction>Fraction</fraction> </locale> Here is my main xml doc: <object> <property> <key>currencyCode</key> <value>USD</value> </property> <property> <key>fraction</key> <value>cent</value> </property> </object> Laura L. Menke IBMUSM07(menkell) Phone 507-253-8901 Tie 5535907 menkell@xxxxxxxxxx When facing a difficult task, act as though it is impossible to fail. If you're going after Moby Dick, take along the tartar sauce. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XML for C++ Update, ssdhanoa | Thread | Re: Using a variable to check to se, Wendell Piez |
XML for C++ Update, ssdhanoa | Date | Re: Using a variable to check to se, John E. Simpson |
Month |