[xsl] Possible to Construct a nodeset "internal" to an XSLT?

Subject: [xsl] Possible to Construct a nodeset "internal" to an XSLT?
From: <ohaya@xxxxxxx>
Date: Mon, 28 Apr 2008 0:30:18 -0400
Hi, 

I'm fairly new to working with XSLT, and I'm doing this within an 
environment where the XSLT is running within an XML appliance. 

I have a situation where my XSLT needs to dynamically construct a 
nodeset that is "internal" to it (e.g., in a variable or parameter), 
so that it can then use that nodeset in a call out to a webservice 
using an extension function (soap-call()) within the appliance. 

To start with, I have an XML document that can be used as a kind of 
"skeleton", and I can bring that document into the XSLT as a nodeset 
using document(), but then I need to modify the value of some of the 
elements in that nodeset before invoking the soap-call() extension 
function. 

Here's the "skeleton" XML: 

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http:// 
www.w3.org/2001/XMLSchema-instance" xmlns:env="http:// 
schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/ 
schemas/management"> 
<SOAP:Body> 
  <m:ctInvoke xmlns:m="urn:sirrus.ws.runtime"> 
    <requests xsi:type="soapenc:Array" 
soapenc:ArrayType="m:CTRequest[1]"> 
      <request xsi:type="m:CTRequest"> 
        <m:id xsi:type="xsd:int">0</m:id> 
        <m:subject xsi:type="m:CTUser"> 
          <m:id xsi:type="xsd:string">++SUBJECT++</m:id> 
        </m:subject> 
        <m:operation xsi:type="m:CTOperation">authorize</m:operation> 
        <resources xsi:type="soapenc:Array" 
soapenc:ArrayType="m:CTResource[1]"> 
          <resource xsi:type="m:CTResource"> 
            <m:type xsi:type="m:CTResourceType">web</m:type> 
            <m:webServerName xsi:type="xsd:string">++HOSTNAME++</ 
m:webServerName> 
            <m:uri xsi:type="xsd:string">++URI++</m:uri> 
          </resource> 
        </resources> 
      </request> 
    </requests> 
  </m:ctInvoke> 
</SOAP:Body> 
</SOAP:Envelope> 

In the above, I've marked the things that need to be "parameterized" 
with "++xxxxxxxxx++", and here's an example after the desired transformation with: 

SUBJECT = test1 
HOSTNAME = foo.whatever.com 
URI = http://services 

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http:// 
www.w3.org/2001/XMLSchema-instance" xmlns:env="http:// 
schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/ 
schemas/management"> 
<SOAP:Body> 
  <m:ctInvoke xmlns:m="urn:sirrus.ws.runtime"> 
    <requests xsi:type="soapenc:Array" 
soapenc:ArrayType="m:CTRequest[1]"> 
      <request xsi:type="m:CTRequest"> 
        <m:id xsi:type="xsd:int">0</m:id> 
        <m:subject xsi:type="m:CTUser"> 
          <m:id xsi:type="xsd:string">test1</m:id> 
        </m:subject> 
        <m:operation xsi:type="m:CTOperation">authorize</m:operation> 
        <resources xsi:type="soapenc:Array" 
soapenc:ArrayType="m:CTResource[1]"> 
          <resource xsi:type="m:CTResource"> 
            <m:type xsi:type="m:CTResourceType">web</m:type> 
            <m:webServerName xsi:type="xsd:string">foo.whatever.com</ 
m:webServerName> 
            <m:uri xsi:type="xsd:string">http://services</m:uri> 
          </resource> 
        </resources> 
      </request> 
    </requests> 
  </m:ctInvoke> 
</SOAP:Body> 
</SOAP:Envelope> 

As I said above, I'm kind of new to all of this, so I'm wondering: 

- Is there a way to accomplish the above? 
- Also, is there a better approach to accomplishing this? 

Thanks in advance, 
Jim 

P.S.  The device that I'm working with supports only XSLT 1.0, with a limited set of the EXSLT functions.

Current Thread