Note that there are some explanatory texts on larger screens.

plurals
  1. POXPath 1.0 return string as node list
    primarykey
    data
    text
    <p>I have a strange dilemma....</p> <p>First of all, I am stuck using XPath 1.0 only, that is what the ancient process the system is still using, so although I'd love to use 2.0, it's not going to happen.</p> <p>I have a node as such: <code>&lt;Column Name="Letters"&gt;A, B, C, D, E, F, G, H, I&lt;/Column&gt;</code></p> <p>And I want the xpath to return a node list of these letters. Is this possible in any way? Is it possible to return a list of nodes derived from the number of letters present in the string? Is it possible to traverse the string, and somehow keep an index of where in the string you are for the next node?</p> <p>Any suggestions, alternatives, and advice are welcome.</p> <p>Thanks in advanced!</p> <p>EDIT: If there were 9 instances of the "Letters" node as seen above, would it be possible to use(assuming I have removed all white space/commas): substring(Letters,1,1) to retrieve the first value, then when the program traverses to the next node, retrieve substring(Letters,2,1), etc, but instead of static indexes, have it return something like: substring(Letters,node2outof9,1)?</p> <p>EDIT: EX)</p> <p><code>&lt;Column Name="Letters"&gt;A, B, C, D, E, F, G, H, I&lt;/Column&gt; &lt;Column Name="Letters"&gt;A, B, C, D, E, F, G, H, I&lt;/Column&gt; &lt;Column Name="Letters"&gt;A, B, C, D, E, F, G, H, I&lt;/Column&gt;</code> ...</p> <p>Say I had the following pseudo-code:</p> <p>foreach node in nodelist (Column @Name=Letters) substring(node, <strong><em>index?</em></strong>, 1)</p> <p>Is there an xpath function or attribute I can use to give me the index for which node out of the nodelist I am currently traversing? </p> <p>I'm thinking of a workaround by using the index of the current node to grab the letter I need. So I'm returning "Letters" 9 times, to grab one letter for each, 1 at a time.</p> <p>I know this is a strange request, so I'll really appreciate any help...</p> <p>UPDATE: The issue was resolved, but had to use a workaround as obviously this cannot be done using solely with XPATH. Thanks to all for the suggestions and advice. Answer to Jakrabbit for close-enough solution with what strange information I supplied. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload