cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Help with specval/savetext comparisons

cleccese
6-Contributor

Help with specval/savetext comparisons

Hi All,

I am trying to do some string functions in Styler 5.4.

Here are the tags:

<new1>
<wuc></wuc> (empty)
<noun>Some Text</noun>
<wuc>Text</wuc>
<noun>Some Text</noun>
<wuc>Text</wuc>
<noun>Some Text</noun>
...
</new1>

I am in <noun> and I want to access the content of <wuc>. I would like to check if <wuc> is empty, and I would also like to compare one of the characters in <wuc>'s content.

My XPATHs are working correctly.

test1.txt is assigned 'A' in the rsrcdesc

What I'm having trouble with are the savetext comparisons:

The second <wuc> is not empty, but it's executing attval="#NONE"
String length = 0 false
EMPTY



The first time ismatch.txt changes from '0' to 'A' I get this:


String length = 0 false
A NOT EQUAL A (for the following tags it's correct: "A EQUALS A")



The first time ismatch.txt changes from 'A' to 'B':


String length = 0 false
A EQUAL B (for the following tags it's correct: "A NOT EQUAL B")

The rest of the results are correct, even when ismatch.txt changes from 'B' to "C', etc.



I played around with the placement before/after with no difference. If there's a better way to check these things, please let me know!



Here's my test code, pretty simple. I probably have some kind of syntax error?

<e-i-c gi="noun" context="new1" occur="all" selector="new1/noun">
<charlist inherit="1">
<indent inherit="0"/">
<savetext textid="isempty.txt"&lt;br"/>conrule="#XPATHSTRING(preceding-sibling::wuc[1][normalize-space(.)])#XPATH"/>
<savetext textid="ismatch.txt"&lt;br"/>conrule="#XPATHSTRING(substring(preceding-sibling::wuc[1][normalize-space(.)],3,1))#XPATH"
placemnt="before"/>
<usetext<br/>source="\String length = 0 \,#XPATHSTRING(string-length(preceding-sibling::wuc[1][normalize-space(.)])=0)#XPATH"
placemnt="before">
<subchars>
<textbrk startln="1" endln="1"/"></subchars>
</usetext>
</charlist>

<att>
<specval attname="isempty.txt" attloc="#FOSI" attval="#NONE"/">
<charsubset>
<usetext source="\" empty=" &quot;=" placemnt="before"></usetext>
</charsubset>
</att>

<att>
<specval attname="test1.txt" attloc="#FOSI" attval="#EQ#ismatch.txt"/">
<charsubset>
<usetext source="test1.txt,\" equals=" \,ismatch.txt&quot;=" placemnt="before">
<subchars>
<textbrk startln="1" endln="1"/"></subchars>
</usetext>
</charsubset>
</att>

<att>
<specval attname="test1.txt" attloc="#FOSI" attval="#NE#ismatch.txt"/">
<charsubset>
<usetext source="test1.txt,\" not=" equal=" \,ismatch.txt&quot;=" placemnt="before">
<subchars>
<textbrk startln="1" endln="1"/"></subchars>
</usetext>
</charsubset>
</att>

</e-i-c>



Thanks for any help!

2 REPLIES 2
cleccese
6-Contributor
(To:cleccese)

In this thread http://portal.ptcuser.org/p/fo/st/topic=21&post=106377#p106377 Suzanne stated that the specval tests had to be put in a psu because #FOSI does not work in the same e-i-c with the enumerat and savetext categories. I just cut the ATTs, pasted them into a psu and called it from a usetext and all three worked!



Thanks Suzanne!



Regards,


Caroline

Glad to be of help, Caroline 🙂

Suzanne


Announcements

Top Tags