Re: [xsl] Convert String to node-set?

Subject: Re: [xsl] Convert String to node-set?
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 2 May 2002 11:35:12 -0400
[Manish M. Shah]>
> I'm attempting to convert a String to a node-set, where I have two
> different XML branches in one XML file.

It is very unlikely that you would need to do what you are asking for.  It's
a bit hard to understand what you want to do, but I do not think you have
described the problem accurately.  I think that you want to produce a
***result tree fragment*** (that is, the result, or output) that indicates
in some way that options "a" and "b" are present in the listing.

This is a very different thing from changing the source tree, or creating
new nodesets.  What you have to do first is to work out what the output
should look like.  Then you have to decide how to match up the options in
"WizardBluePrint" with the options in "listing".  Then you have to construct
the xslt code that will create the output.

There will no doubt be several ways to accomplish the matching you want.
None of them would require converting anything to a nodeset.  It is really a
matter of understanding the conditions for selecting nodes.


Tom P

> Here's my XML file:
> <JSPRoot>
> <listing>
> <saleTerms>a</saleTeerms>
> <saleTerms>b</saleTerms>
> </listing>
> <WizardBluePrint>
> <Property>
> <Category>
> <Group>
> <Field>
> <DataLocation>/listing></DataLocation>
> <DatabaseVariableName>saleTerms</DataLocation>
> <Option>a</Option>
> <Option>b</Option>
> <Option>c</Option>
> </Field>
> </Group>
>   </Category>
>   </Property>
> </WizardBleuPrint>
> </JSPRoot>
> What I need to do is iterate through JSPRoot/listing/saleTerms,and since
> it has a and b, i want to set a and b as selected in
> JSPRoot/WizardBluePrint/Property/Category/Group/Field.
> I tried saxon:node-set() to convert, and no luck. Anyone have any ideas.
> Here's my code:
> <xsl:for-each
>                    <xsl:for-each select="InputMechanism/Option">
>                    <xsl:value-of select="$dataLocation"/>
>                    <option>
>                       <xsl:attribute name="value">
>                          <xsl:value-of
> select="normalize-space(@value)"/>
>                       </xsl:attribute>
>                          <xsl:if
>                               <xsl:attribute name="selected">
>                                  selected
>                               </xsl:attribute>
>                          </xsl:if>
>                          <xsl:value-of
> select="normalize-space(@value)"/>
>                     </option>
>                    </xsl:for-each>
>                  </xsl:for-each>
> Thanks.
> Manish
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread