xsl-list
[Top] [All Lists]

RE: From a string to node-set

2003-08-27 23:33:47
Hi,

I know there was difficulty to convert a string to
node-set before. Here I just want to check if there is
any new development regarding to this. Any workaround

XSLT 2.0, but it's now finished yet.

I created a template called replacement with one
parameter, which checks the test.xml to see if there
is an element there, if yes, copy that element and
value; if not, create that element.

My problem is that if i pass the parameter as node-set
i need to convert node-set to string. However, that
node-set is empty since the element is not there. If I
pass the parameter as string, I need to convert string
into node-set and test its existence. That causes me a
problem.

You won't be able to make the latter test even if you could convert a string 
into a node-set, because that new node-set wouldn't contain the same nodes as 
the source tree. You could only test if an element by that name exits, testing 
for identity wouldn't work.

Anyhow, pass both the name and the node-set, as two parameters. 
 
      <xsl:otherwise>
              <xsl:element name="?????name($pName)"/>

You need to use AVT, ie.

  <xsl:element name="{name($pName)}">
    ...

Cheers,

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>