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

Element Content - Test with FOSI

vincen.hassen.c
1-Newbie

Element Content - Test with FOSI

Using FOSI, I am trying to test whether an element has any content and
react accordingly. The element is TITLE and is wrapped in PARA0. At
the PARA0 I am setting a variable, title.txt to \\.

<savetext textid="title.txt" conrule="\\"> .



Then at the title I have the following save text and two attribute
rules:

<savetext textid="title.txt" conrule="#CONTENT">



<att>

<specval attname="title.txt" attloc="#FOSI" attval="#ANY">

<charsubset>

<usetext source="\This" title=" has=" content\&quot;="></usetext>

</charsubset>

</att>



<att>

<specval attname="title.txt" attloc="#FOSI" attval="#NONE">

<charsubset>

<usetext source="\This" title=" is=" empty\&quot;="></usetext>

</charsubset>

</att>



With content or not in title, the result is "This Title is EMPTY" .



Any help would be appreciated.

Thanks,

Vince

8 REPLIES 8

Vince,
I think the problem is that the <att>s are getting evaluated at the
beginning of the element, before any content has been placed into the
text variable. You might try a usetext in the e-i-c (not in an att)
that uses a pseudo-element whose e-i-c performs the test on the
variable. This way, you can set the usetext to run at the end of the
element (placemnt="after", IIRC). Something like:

<savetext textid="title.txt" conrule="#CONTENT">
<usetext source="&lt;title-txt-test"></title-txt-test>"></usetext>

and

<e-i-c gi="title-txt-test">
<charlist></charlist>
<att>
<specval attname="title.txt" attloc="#FOSI" attval="#ANY">
...
</att>
<att>
<specval attname="title.txt" attloc="#FOSI" attval="#NONE">
...
</att>
</e-i-c>

Of course, I didn't test this at all, so YMMV. 🙂

-Brandon 🙂




On 7/25/07, Hassen, Vince D Contr 557 ACSS/GFEAC <
Vincen.Hassen.ctr@tinker.af.mil> wrote:
>
> Using FOSI, I am trying to test whether an element has any content and
> react accordingly. The element is TITLE and is wrapped in PARA0. At the
> PARA0 I am setting a variable, title.txt to \\.
>
> <savetext textid="title.txt" conrule="\\"> .
>
> Then at the title I have the following save text and two attribute rules:
>
>
> <savetext textid="title.txt" conrule="#CONTENT">
>
> <att>
>
> <specval attname="title.txt" attloc="#FOSI" attval="#ANY">
>
> <charsubset>
>
> <usetext source="\This" title=" has=" content\&quot;="></usetext>
>
> </charsubset>
>
> </att>
>
>
>
> <att>
>
> <specval attname="title.txt" attloc="#FOSI" attval="#NONE">
>
> <charsubset>
>
> <usetext source="\This" title=" is=" empty\&quot;="></usetext>
>
> </charsubset>
>
> </att>
>
>
>
> With content or not in title, the result is "This Title is EMPTY" .
>

I your coding with #NONE, but I think that detects whether or not
title.txtexists. Not its contents. A null value != #NONE, in other
words.

Try This for your #NONE test:
<specval attname="title.txt" attloc="#FOSI" attval="#NE#\\">

If that works and you care about parallelism, try this for your #ANY test:
<specval attname="title.txt" attloc="#FOSI" attval="#EQ#\\">

--
Paul Nagai

Hi Vince--

You have to use an ACL function and the SYSTEM-FUNC attloc to do this. There's an example that I think is almost exactly what you're looking for in the online help: type "help 1325" on the command line (in 5.3 M010). If you're using a different version of Editor and that help number brings up the wrong topic, go to the index and look up "Attribute rules, passing values to from functions and variables".

--Clay

Vince,

I know you've got some responses on this, but here's a thought. What all have said thus far is fairly correct. The help Clay mentions shows the example you're looking for alright. The problem is that it doesn't mention the timing part of it. With, ACL, you can achieve this functionality, but it's somewhat over-kill unless there is no way to test after the <title> elelment. As Brandon (I believe) mentioned you have to get the variable filled with the element content before the element you actually test it in. This goes back to the old problem centered around the fact the FOSI moves forward testing as it goes. If it hasn't reached an element, or its content, it doesn't exist yet.

The <title> element can do the savetext to your variable. However, the next elment outside the <title> is where you need to do your test, and it will be reliable with "#ANY" or "#NONE" as the values to test for.

If you can't wait until after the element, meaning you have no other element to use, you will need to do an ACL function call using attloc="system-func" as your <att> test. The ACL function can then get the current OID, get its contents, and then evaluate it returning a value to stuff in a variable to display within the <title> element. Obviously, this is much more complicated.

Hope this helps,

Bob

Vince,

I think you've gotten some good advice so far.  First, the savetext is not an attribute so, the <specval> cannot evaluate the content as an attribute.  The comments on the SYSTEM-VAR are the direction you need to be going. 

A couple of other things on using an attribute in a <specval> or <fillval>.  The attribute must be either part of the current element or with the 'attloc' an attribute in a parent element (i.e, first, second or what ever).  It cannot be a sibling, a child or an aunt or uncle (the sibling of a parent). 

As too having to test the variable in the following element, off the top of my head, I would say no you don't.  Just make sure you have saved the string prior to running the <att>s.

Your concept is good, just getting that sorry syntax to work is the problem. 

Lynn

---- "Hassen wrote:
> Using FOSI, I am trying to test whether an element has any content and
> react accordingly.  The element is TITLE and is wrapped in PARA0.  At
> the PARA0 I am setting a variable, title.txt to \\.
>
> <savetext textid="title.txt" conrule="\\"> . 
>

>
> Then at the title I have the following save text and two attribute
> rules:
>
> <savetext textid="title.txt" conrule="#CONTENT">
>

>
> <att>
>
> <specval attname="title.txt" attloc="#FOSI" attval="#ANY">
>
> <charsubset>
>
> <usetext source="\This" title=" has=" content\&quot;="></usetext>
>
> </charsubset>
>
> </att>
>

>
> <att>
>
> <specval attname="title.txt" attloc="#FOSI" attval="#NONE">
>
> <charsubset>
>
> <usetext source="\This" title=" is=" empty\&quot;="></usetext>
>
> </charsubset>
>
> </att>
>

>
> With content or not in title, the result is "This Title is EMPTY" . 
>

>
> Any help would be appreciated.
>
> Thanks,
>
> Vince
>
>      
> ----------     

Vince,
You can use a pseudo-element for the #FOSI tests so the savetext and #FOSI aren't in the same e-i-c.

Good luck!
Suzanne Napoleon
www.FOSIexpert.com


Vince,
I know you've got some responses on this, but here's a thought. What all have said thus far is fairly correct. The help Clay mentions shows the example you're looking for alright. The problem is that it doesn't mention the timing part of it. With, ACL, you can achieve this functionality, but it's somewhat over-kill unless there is no way to test after the <title> elelment. As Brandon (I believe) mentioned you have to get the variable filled with the element content before the element you actually test it in. This goes back to the old problem centered around the fact the FOSI moves forward testing as it goes. If it hasn't reached an element, or its content, it doesn't exist yet.
The <title> element can do the savetext to your variable. However, the next elment outside the <title> is where you need to do your test, and it will be reliable with "#ANY" or "#NONE" as the values to test for.
If you can't wait until after the element, meaning you have no other element to use, you will need to do an ACL function call using attloc="system-func" as your <att> test. The ACL function can then get the current OID, get its contents, and then evaluate it returning a value to stuff in a variable to display within the <title> element. Obviously, this is much more complicated.
Hope this helps,
Bob

Vince,

You might try saving the value of title to "after" (default is "before"
if not specified). If title.txt is a time independent variable this
will probably work.

<stringdecl textid="title.txt" status="1">

<savetext textid="title.txt" conrule="#CONTENT" placemnt="after">



-Andy

\ / Andy Esslinger F-22 Tech Order Data
_____-/\-_____ (817) 777 3047 LM Aero Box 748
\_\/_/ Fort Worth, TX 76101


I realized this morning that I omitted the placemnt="after" in the
<usetext> when I typed up the example, so the first part should be:

<savetext textid="title.txt" conrule="#CONTENT">
<usetext source="&lt;title-txt-test"></title-txt-test>"
placemnt="after"></usetext>

-Brandon 🙂



Announcements