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

Comparing Attribute Values in FOSI

Highlighted

Comparing Attribute Values in FOSI

Does FOSI have the capability of determining if one numerical attribute
value is greater than another?

I'm creating a FOSI stylesheet for an XML document which has a
last_distribution_date attribute in an element called "book" and a
revision attribute in an element called "section". The
last_distribution_date attribute contains a numerical date (MM/DD/YY -
i.e. 03/01/05), and its purpose is to track the last time the document
was printed for distribution. The revision attribute also contains a
numerical date, and its purpose is to track the last date that the
section was updated.

I would like to use FOSI attribute test values or some other function to
be able to determine if the date for the last_distribution_date
attribute is less than the date for the revision attribute. That would
give me the capability to apply special formatting to those sections
that have changed since the document was last printed (the purpose being
to alert the reader to content changes since the last release in the
body of the document).

Also, is there an ACL command that I can use to enter an attribute value
for every occurrence of a section element in an XML document? For
example - for every section element in this document, enter "03/10/05"
as the value for the revision attribute.

Thanks in advance for any help!
Tags (2)
1 REPLY 1
Highlighted

Re: Comparing Attribute Values in FOSI

First a warning:

The format you are using for dates is not really numerical at least as
far as comparisons are concerned. There are various pieces of software
that know how to deal with comparisons of date strings but this is
non-trivial.

Arbortext has extended the FOSI standard to support XPath expressions at
certain locations in your FOSI. See the document 28001C.sgm in your
install tree and search for XPath, you want the section about specifying
E-I-Cs using XPath. In the most recent copy, the section you want is
B.3.6.9 but it may have moved depending on your version. This extension
will let you use an xpath attribute with a match expression to do the
special formatting you want. The next question is can you come up with
an XPath expression that meets your needs. Simple numeric compares are
possible such as is 2 > 3. But as I mentioned above, dates are not
simple.

You will also need to code a short loop to set an attribute on multiple
tags. You can get the list of oids that are section tags by calling
xpath_nodeset(yourarraryhere, "section", 0). Then loop through the list
and set each tag.

John Dreystadt
Director of Product Management
Arbortext

Announcements