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

Re: xslt create a variable from external xml file

Subject: Re: xslt create a variable from external xml file
From: "Chris Papademetrious chrispitude@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 27 Aug 2023 12:27:36 -0000
Re:  xslt create a variable from external xml file
Hi Phillip,

Try a simple testcase consisting of the following three files in the same
local directory:

<!-- input.xml -->
<result/>


<!-- data.xml -->
<data>hello</data>


<!-- stylesheet.xsl -->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="3.0">
  <xsl:template match="/*">
    <xsl:copy>
      <xsl:value-of select="document('data.xml')/*"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

When I run this on my system, I get:

$ java -jar $SAXON_JAR -xsl:stylesheet.xsl -s:input.xml
<?xml version="1.0" encoding="UTF-8"?><result>hello</result>

What do you get?

 - Chris





On Sun, Aug 27, 2023 at 6:49b/AM LEGAULT, PHILLIP plegault@xxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I have tried everything and Ibm unable to get the values from the
external
> xml file.
>
>
>
>
>
>
>
> *From:* Martin Honnen martin.honnen@xxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
> *Sent:* Tuesday, August 22, 2023 11:22 AM
> *To:* xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> *Subject:* [EXTERNAL] Re:  xslt create a variable from external xml
> file
>
>
>
>
>
> On 22.08.2023 17:10, LEGAULT, PHILLIP plegault@xxxxxxxxxx wrote:
>
> This one gives me an error,
>
> Error at xsl:param on line 266 column 107 of process.xsl:
>
>   XPST0003 XPath syntax error at char 39 on line 266 near {...environment
> => normalize-sp...}:
>
>     Unexpected token ">" in path expression
>
> Error at xsl:param on line 266 column 107 of process.xsl:
>
>   XPST0081 SequenceType syntax error at char 0 in {xs:string}:
>
>     Undeclared namespace prefix {xs}
>
> Failed to compile stylesheet. 2 errors detected.
>
>
>
> Syd used XPath 3.1 syntax with XSLT 3, if you use a version of Saxon that
> only supports XSLT 2.0 with XPath 2.0 then change
>
>
>
>
>
>   <xsl:param name="env" select="document('./inv/env.xml')/environment =>
> normalize-space()" as="xs:string"/>
>
> to
>
>
>
>   <xsl:param name="env"
> select="normalize-space(document('inc/env.xml')/environment)"/>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3514465> (by
> email)
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3519310> (by
> email <>)

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.