[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XML fragment as a param ?
"Fraser" == Fraser Goffin <goffinf@xxxxxxxxxxx> writes:
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|