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

RE: XML fragment as a param ?

Subject: RE: XML fragment as a param ?
From: "Fraser Goffin" <goffinf@xxxxxxxxxxx>
Date: Thu, 03 Nov 2005 11:46:10 +0000
could not find external entity
"Fraser" == Fraser Goffin <goffinf@xxxxxxxxxxx> writes:

Fraser> Is it possible to pass in an XML fragment as a param and Fraser> then access nodes in the fragment as well as those in the Fraser> main source instance ?? For example could I compare a

Colin> Yes. See the discussion this week.

   Fraser> node value in the original source instance with one in the
   Fraser> fragment passed in as a param ??

Colin> Yes.

Colin, thanks for the pointer. I assume you mean the technique that was discussed in relation to the document function (note: I am using XSLT 1.0 rather than 2). I tried this (in XML Spy for now), but got the error

'Error in function doument; Could not find external entity'

(see example XSLT below).

Is this perhaps related to to the use of data: not being supported or am I doing something else that is wrong ??

I will be using Xerces/Xalan in the 'real' environment (I know I should use this for testing also), does anyone know whether this technique will work with it/them ??

I haven't come across data: before. I thought that the document() function accepted a resolvable URI as a parameter, so does the use of data: provide a sort of resolver itself then ?

:-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>


 <xsl:param name="inboundXML">
   <xsl:text>default-value</xsl:text>
 </xsl:param>

<xsl:template match="/">

<!-- try out the suggested technique for passing an XML string to the document function -->

<xsl:variable name="myVar" select="document(concat('data:,text/xml',$inboundXML))"/>

   <!-- output the result -->
   <rootContainer>
       <xsl:value-of select="$inboundXML//Three"/>
   </rootContainer>

</xsl:template>

</xsl:stylesheet>


XML sent in as param 'inboundXML' :-


<?xml version="1.0" encoding="UTF-8"?>
<Numbers>
 <Odds>
   <One>1</One>
   <Three>3</Three>
   <Five>5</Five>
 </Odds>
 <Evens>
   <Two>2</Two>
   <Four>4</Four>
   <Six>6</Six>
 </Evens>
</Numbers>

Fraser> Is it possible to pass in an XML fragment as a param and then
Fraser> access nodes
Fraser> in the fragment as well as those in the main source instance

Michael>Yes. The way you pass the value depends of course on your processor API.

Michael, not sure what you mean, I'm using Xerces/Xalan if that helps ?

Thanks

Fraser.

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.