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

FOSIs - putting attribute values in gentext

unknown1
1-Newbie

FOSIs - putting attribute values in gentext

It's not clear to me how to take an attribute value and turn it into
generated text. I know I can use specval to test for a specific value, say,
type=italic, and include a usetext element with attribute source=\ITALIC \.
But what if I need to capture arbitrary idref values and display them as
generated text? Fillval appears to be the key but I haven't figured out the
usage. If anyone can pass along an example I'd be grateful.

Matt
19 REPLIES 19

Bernard,

What you are going to want to do is use a #CONTENT in the source of the
usetext. It should look something like this:











This fillval will take the content of the attribute id and through a the
source of a usetext, put the ID the text string.

There is one additional attribute in the fillval you can use if the
attribute you want to use is not in the current element. This is location.
The element that contains the attribute you are going to fill from must be
an ancestor of the current element.

Hope this helps a bit.

Lynn E. Hales
Information Systems Specialist
Newport News Shipbuilding
(757)688-9324
hales_le@nns.com

Matthew:

It sounds like you want to output the contents of an attribute with type
IDREF, which isn't possible using fillval. You can fillval the contents of
an attribute of type ID into a usetext source or savetext conrule, but when
an IDREF attribute is fillval-ed into a usetext source, it is treated as a
textid to support cross referencing. It is not treated as literal text. If
the value of an IDREF attribute were treated as literal text, cross
referencing wouldn't work.

The way to output IDREF attribute contents is to use ACL to copy the
contents of the IDREF attribute into a pseudo-attribute, or available DTD
attribute, which is not type IDREF. Then the FOSI can fillval from a
non-IDREF attribute into a usetext source and output the literal text.

BTW: #CONTENT is not needed in the usetext source when fillval is used.
#CONTENT refers to element content, not attribute content.

Please contact help@arbortext.com if you need more information on
pseudo-attributes.

Best regards,
Suzanne Napoleon
Arbortext, Inc.

At 11:09 AM 11/16/98 -0500, Bernard, Matthew (RTIS) wrote:
>It's not clear to me how to take an attribute value and turn it into
>generated text. I know I can use specval to test for a specific value, say,
>type=italic, and include a usetext element with attribute source=\ITALIC \.
>But what if I need to capture arbitrary idref values and display them as
>generated text? Fillval appears to be the key but I haven't figured out the
>usage. If anyone can pass along an example I'd be grateful.
>
>Matt
>
>

>
cleccese
6-Contributor
(To:unknown1)

How would I save the IDREF as described here? I need help with the ACL, which I know nothing. I've got xrefs in Styler 5.4 that aren't resolving and I was hoping to at least get the XREFID to show up as text, if not a link. Any advice would be appreciated!


The way to output IDREF attribute contents is to use ACL to copy the contents of the IDREF attribute into a pseudo-attribute, or available DTD attribute, which is not type IDREF. Then the FOSI can fillval from a non-IDREF attribute into a usetext source and output the literal text.



In Reply to Legacy User:


> > From: Suzanne Napoleon > Date: Mon, 16 Nov 1998 12:46:33 -0500 > Subject: Re: FOSIs - putting attribute values in gentext > > Matthew: > > It sounds like you want to output the contents of an attribute with type > IDREF, which isn't possible using fillval. You can fillval the contents of > an attribute of type ID into a usetext source or savetext conrule, but when > an IDREF attribute is fillval-ed into a usetext source, it is treated as a > textid to support cross referencing. It is not treated as literal text. If > the value of an IDREF attribute were treated as literal text, cross > referencing wouldn't work. > > The way to output IDREF attribute contents is to use ACL to copy the > contents of the IDREF attribute into a pseudo-attribute, or available DTD > attribute, which is not type IDREF. Then the FOSI can fillval from a > non-IDREF attribute into a usetext source and output the literal text. > > BTW: #CONTENT is not needed in the usetext source when fillval is used. > #CONTENT refers to element content, not attribute content. > > Please contact help@arbortext.com if you need more information on > pseudo-attributes. > > Best regards, > Suzanne Napoleon > Arbortext, Inc. In 8.0 you can use #CONTENT(attrname) with any attribute for this purpose. No is needed. Just put: in the e-i-c's charlist. --------------------------------------------- John Lloyd Arbortext Inc. jjl@arbortext.com 1000 Victor's Way +1 313.327.6066 Ann Arbor, Michigan 48108 USA

Hi Caroline,

Maybe I missed an earlier message on this topic but what is it you're
trying to do? Styler should be able to satisfy most cross reference
requirements without resorting to custom coding. Have you proven through
experimentation (and/or consultation with PTC Support) that what you are
trying to do is not possible?

Again, sorry if I missed something that explained where you're trying to go.


On Tue, Jan 15, 2013 at 5:24 PM, Caroline Leccese <
caroline@thecodesource.net> wrote:

> How would I save the IDREF as described here? I need help with the ACL,
> which I know nothing. I've got xrefs in Styler 5.4 that aren't resolving
> and I was hoping to at least get the XREFID to show up as text, if not a
> link. Any advice would be appreciated!
>
> The way to output IDREF attribute contents is to use ACL to copy the
> contents of the IDREF attribute into a pseudo-attribute, or available DTD
> attribute, which is not type IDREF. Then the FOSI can fillval from a
> non-IDREF attribute into a usetext source and output the literal text.
>
>
> In Reply to Legacy User:
>
> > > From: Suzanne Napoleon > Date: Mon, 16 Nov 1998 12:46:33 -0500 >
> Subject: Re: FOSIs - putting attribute values in gentext > > Matthew: > >
> It sounds like you want to output the contents of an attribute with type >
> IDREF, which isn't possible using fillval. You can fillval the contents of
> > an attribute of type ID into a usetext source or savetext conrule, but
> when > an IDREF attribute is fillval-ed into a usetext source, it is
> treated as a > textid to support cross referencing. It is not treated as
> literal text. If > the value of an IDREF attribute were treated as literal
> text, cross > referencing wouldn't work. > > The way to output IDREF
> attribute contents is to use ACL to copy the > contents of the IDREF
> attribute into a pseudo-attribute, or available DTD > attribute, which is
> not type IDREF. Then the FOSI can fillval from a > non-IDREF attribute into
> a usetext source and output the literal text. > > BTW: #CONTENT is not
> needed in the usetext source when fillval is used. > #CONTENT refers to
> element content, not attribute content. > > Please contact
> help@arbortext.com if you need more information on > pseudo-attributes. >
> > Best regards, > Suzanne Napoleon > Arbortext, Inc. In 8.0 you can use
> #CONTENT(attrname) with any attribute for this purpose. No is needed. Just
> put: in the e-i-c's charlist. ---------------------------------------------
> John Lloyd Arbortext Inc. jjl@arbortext.com 1000 Victor's Way +1
> 313.327.6066 Ann Arbor, Michigan 48108 USA
>
>
cleccese
6-Contributor
(To:unknown1)

Hi Paul,


No, I haven't consulted with PTC. I am in a bit of a crunch, and I have some XREFs that work and some don't, even though they're all set up the same by using a target's ID. For example, I have a tag <sttecwp id="wp00300"> and later in the document the <xref xrefid="wp00300"> but there is no link back to <sttecwp>. XREFs to figures, tables and paragraphs are working.


So I thought if I could at least get the text (wp00300) if not a link to show up that was better than nothing for now.

is <sttecwp> a FormalBlock? I have this vague recollection that to complete
an ID/IDREF the target must be a FormalBlock.


On Tue, Jan 15, 2013 at 6:07 PM, Caroline Leccese <
caroline@thecodesource.net> wrote:

> Hi Paul,
>
> No, I haven't consulted with PTC. I am in a bit of a crunch, and I have
> some XREFs that work and some don't, even though they're all set up the
> same by using a target's ID. For example, I have a tag <sttecwp<br/>> id="wp00300"> and later in the document the <xref xrefid="wp00300"> but
> there is no link back to <sttecwp>. XREFs to figures, tables and paragraphs
> are working.
>
> So I thought if I could at least get the text (wp00300) if not a link to
> show up that was better than nothing for now.
>

Sometimes viewing your .style file in a text editor (don't make/save any
changes there, it's too easy to break the whole thing) and looking at the
components that are working (links to table for example) versus links that
do not (links to sttecwp for example) and the targets of both (table,
sttecwp) might reveal something you forgot to do or some other limitation
of how your elements are defined.


cleccese
6-Contributor
(To:unknown1)

Hi Paul,


No, it is not a FormalBlock, but the tables and figures are, which do work. Could it be? Thank you for the other tip as well. The "Insert Link" button in Editor works so I'm hoping that is acceptable.



In Reply to Paul Nagai:


is <sttecwp> a FormalBlock? I have this vague recollection that to complete
an ID/IDREF the target must be a FormalBlock.


On Tue, Jan 15, 2013 at 6:07 PM, Caroline Leccese <
@caroline@thecodesource.net> wrote:

> Hi Paul,
>
> No, I haven't consulted with PTC. I am in a bit of a crunch, and I have
> some XREFs that work and some don't, even though they're all set up the
> same by using a target's ID. For example, I have a tag <sttecwp<br/>> id="wp00300"> and later in the document the <xref xrefid="wp00300"> but
> there is no link back to <sttecwp>. XREFs to figures, tables and paragraphs
> are working.
>
> So I thought if I could at least get the text (wp00300) if not a link to
> show up that was better than nothing for now.
>

I don't know anything about Styler, but I do know that in FOSI, cross-ref targets need to have a savetext value in order to work. Perhaps FormalBlock have a savetext (or whatever the Styler term for it is) and the others do not and this might explain some of the problem.
cleccese
6-Contributor
(To:unknown1)

I was able to get the XREFs to work by tweaking the examples in the Styler help "Supporting automatic cross referencing"


The XREFs had to be manually created.


Anyway, I would like to format the link text from say, "wp00400" (the id attribute) to "WP 004 00"


I tried saving the id to a variable, xref-tbl.txt, and at least removing the wp


<savetext textid="Label_Number.xref"&lt;br"/>conrule="!WP !,#XPATHSTRING(substring(xref-tbl.txt,3,3))#XPATH"
xrefidtag="wp"/>


thinking it would look like "WP 004" but all I got was "WP " in my link text.


So this is in the <wp> tag:


<att>
<fillval attname="id" fillcat="savetext" fillchar="conrule"/">
<charsubset>
<savetext textid="xref-tbl.txt"/"></charsubset>
</att>


<att>
Removing this line seemed to have no effect.
<charsubset>
<savetext textid="Label_Number.xref"&lt;br"/>conrule="!WP !,#XPATHSTRING(substring(xref-tbl.txt,3,3))#XPATH"
xrefidtag="wp"/></charsubset>
</att>


I've checked xref-tbl.txt, the id is in there.


And this is in <xref>:


<att>
<specval attname="xrefid" attval="#ANY"/">
<charsubset>
<usetext source="#XREF(xrefid,Label_Number.xref)" placemnt="after">
</usetext>
</charsubset>
</att>

Hi Caroline--



I'm not generally a FOSI guy, but I think your problem may be that you
are confusing FOSI variables with XPath variables. I think the problem
may be where you try to use the XPath substring() expression to extract
a substring from the value of a FOSI variable. Generally, the XPath
substring() function would want an XPath expression as the first
parameter--either a literal string enclosed in quotes, or an XPath
expression that can be converted to a string (e.g. element content or
attribute value).



If the string you want to extract the substring from is the "id"
attribute of the current element, you could try this:



<savetext textid="Label_Number.xref"&lt;br"/>
conrule="!WP !,#XPATHSTRING(substring(@id,2,3))#XPATH"

xrefidtag="wp"/>



If that doesn't work, you may need someone who knows more about FOSI
than I do to help out.



--Clay



Clay Helberg

Senior Consultant



TerraXML

1380 Forest Park Circle, Suite 100

Lafayette, CO 80027

It appears like you are trying to use the "substr(txt,n1,n2) ACL function directly from inside the savetext construction rule (from what I can see in the documentation, I didn't find #XPATHSTRING as a valid construct, but I'm on 5.4, this may be specific to 6).

What I would suggest is writing an ACL function to add the whitespace and uppercase the xref string, and call it from the e-i-c attribute rule in question. Look in the help system for "Passing values to attribute rules using variables and functions". This looks like the direction you're heading towards, based on your example, and this should get you where you want to go.

Here is a pair of ACL and FOSI fragments that I use to output a
human-friendly date/time. I place the function in an ACL in PE's editinit
folder. Any FOSI can call the function. I think any Styler stylesheet
should be able to as well, however, it'd probably have to do so from a FOSI
source edit. Anyhow, you should be able to easily manipulate the
architecture of this pair if not the actual coding. The one trick I have to
explain (since I didn't choose a function that actually manipulates $oid)
is that you can perform ACL string functions on $oid when inside the
function named date_time() below. That's where you're going to do your
three subtr() operations before returning the result.

By the way, some of you will now note the artistic license I took reporting
a while back that I laughed out loud when I realized I had coded "return
$end_times" 😉

function date_time(win,oid) {

# Desired: dd mmm yyyy hh:mm

# Default: Fri Oct 26 22:44:05 2012

$t = time_date();

$t = ctime(time()-25200); # 25200 = 7 * 60 * 60

$dd = substr($t,9,2);

$mmm = substr($t,5,3);

$yyyy = substr($t,21,4);

$hhmm = substr($t,12,5);

end_time = $dd . ' ' . $mmm . ' ' . $yyyy .
'' . $hhmm

return $end_time;

}





<att>

<fillval attname="beam_fosi::date_time" attloc="system-func"&lt;br"/>fillcat="savetext" fillchar="conrule">

<charsubset>

<savetext textid="date_time.txt">

<usetext source="date_time.txt">

<subchars></subchars>

</usetext>

</charsubset>
</att>


cleccese
6-Contributor
(To:unknown1)

Hi Clay,


You are correct, I was confusing XPATH with FOSI variables. Your solution worked:


<savetext textid="Label_Number.xref"&lt;br"/>conrule="!WP !,#XPATHSTRING(substring(@id,3,3))#XPATH,! !,#XPATHSTRING(substring(@id,6,2))#XPATH"
xrefidtag="wp"/>


Paul,


I am grateful for your code snippets, it was just what I was looking for to cut my teeth on ACL.


Thank you!

See, and XPath always ends up cutting its teeth on me ...


On Tue, Jan 22, 2013 at 7:03 PM, Caroline Leccese <
caroline@thecodesource.net> wrote:

> Hi Clay,
>
> You are correct, I was confusing XPATH with FOSI variables. Your solution
> worked:
>
> <savetext textid="Label_Number.xref"&lt;br"/>> conrule="!WP !,#XPATHSTRING(substring(@id,3,3))#XPATH,!
> !,#XPATHSTRING(substring(@id,6,2))#XPATH"
> xrefidtag="wp"/>
>
> Paul,
>
> I am grateful for your code snippets, it was just what I was looking for
> to cut my teeth on ACL.
>
> Thank you!
>

I usually end up with bite marks on my butt.

🙂



Actually, I learned XSLT (and hence XPath) before I started using
Arbortext. So for me, XPath is the "natural" way to think of such
things, which is probably why I have to twist my brain around in knots
to try to grok FOSI.



Clay Helberg

Senior Consultant



TerraXML

1380 Forest Park Circle, Suite 100

Lafayette, CO 80027

Hi Clay,

Weren't you working on an APP stylesheet a little while ago? What was that like?

Suzanne


Announcements