Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Is it possible to use a variable in input xpath (or any xpath) in input form?

Avatar

Avatar
Validate 1
Level 1
HeleneHH
Level 1

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
HeleneHH
Level 1

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
HeleneHH
Level 1

05-06-2020

Is it possible to use a variable in an xpath in Input Forms?

 

Something like this? (I know this exact thing won't work, but just to illustrate)

 

 

<!-- Something that would result in the xpath reading e.g. "parameters/keywords/@second_keyword" -->
<input label="Keyword" xpath="'parameters/keywords/@' + [/tmp/@keywordNumber] + '_keyword'"/>

 

 

 


Fore example / More elaborate explanation..:

If I have this in a data schema:

 

 

<srcSchema ...>
    <element label="Parameters" name="parameters">
      <element label="Keywords" name="keywords">
        <attribute dbEnum="xtk:enum:first_keyword" label="First Keyword" length="50" 
                   name="first_keyword" pkgStatus="always" type="string" xml="true"/>
        <attribute dbEnum="xtk:enum:second_keyword" label="Second Keyword" length="50" 
                   name="second_keyword" pkgStatus="always" type="string" xml="true"/>
        <attribute dbEnum="xtk:enum:third_keyword" label="Third Keyword" length="50" 
                   name="third_keyword" pkgStatus="always" type="string" xml="true"/>
      </element>
    </element>
</srcSchem>

 

 

 

And let's say this in an external delivery input form:

 

 

<form ... >
<entry>
    <!-- Variable that can contain "first", "second" or "third" -->
    <set value="second" xpath="/tmp/@keywordNumber"/>
</entry>

    <container ... >
        <!-- Showing currently the enum list (hard coded) called "first_keyword", but I want "first" not to be hard coded -->
        <input label="Keyword" xpath="parameters/keywords/@first_keyword"/>
    </container>

</form>

 

 


Is there a simple ish way of using e.g. /tmp/@keyword in the input xpath instead of "first", "second" or "third" being hard coded?

So I hope there's something like this existing: (Again, I know this below does not work, but hope you get the idea of what I want to achieve)

 

 

<!-- Something that would result in the xpath reading "parameters/keywords/@second_keyword" -->
<input label="Keyword" xpath="'parameters/keywords/@' + [/tmp/@keywordNumber] + '_keyword'"/>

 

 

 

I've also looked into xpath-valuesxpathLinkxpathExpr, xpathEnum, and a few others, but not sure how they work...


Would really appreciate if anyone here knows if this really is doable and how!

Accepted Solutions (0)

Answers (0)