Skip to main content
Feb 25, 2014 3:14 PM UTC
Question

attribute value with percent sign

Hi,


I am trying to create some generated text in a fosi for several different attribute values for Units of Measurement. In the DTD, there is an attribute value of "%" for percentage units.


<xs:enumeration value="%"/">


Is this a reserved character in fosi? because when you choose this value in the document and then attempt to format the document, the value isn't recognized as matching anything, it generates an error in Editor:


[A27023]
The value of this <specval attval="%"> does not conform to the Declared Attribute Value (ENUMERATED) of the attribute in the document instance against which the <specval> tests


Any advice?


Thanks, KM

    13 replies

    Feb 25, 2014 3:37 PM UTC
    In XML, some characters are reserved for internal use and you must replace them by entity references when they are used in data. % is one of them,

    Feb 25, 2014 4:25 PM UTC
    Kim,



    First, FOSI is an SGML document and thus follows slightly different rules
    than an XML instance. For the character "%" is a RESERVED character.



    In this case, the "%" is a PERO (parameter entity reference open) character
    and as such is not allowed in a CDATA attribute (which the attribute
    'attval' is in the FOSI).

    I am not sure the <specval> would work if you used one of the character
    entity values for '%' (e.g., % [ISO] or % [Unicode]). Given
    the SGML history of FOSI I would try the % as the value and see what
    happens.



    Basically, SGML allows anything in CDATA EXCEPT characters that will be
    interpreted as markup. This includes characters such as "<", "&", and "%".



    Lynn


    kmccainAuthor
    Feb 26, 2014 3:02 PM UTC

    Hi,


    I did try both of those entity values in the FOSI attval but they produce the same error as before. I could get it to work if I could change the enumerated value in the Schema file, but I can't do that. I guess the writers will have to live with not seeing the percent sign when they generate proofs unless I can come up with some other solution.


    Thanks for the info.


    KM

    Feb 26, 2014 3:06 PM UTC
    Kim,



    What exactly are you trying to do? The 'attval' is a value in an attribute
    in the data that is to be compared and if valid/true then some action is
    taken. The 'attval' is not the output.



    Lynn


    Feb 26, 2014 5:04 PM UTC

    Kim,


    Try using the following in your <specval...> :


    <specval attloc="" attname="" attval="#EQ#\%">


    Obviously, attloc and attname need something. The attloc can be omitted if testing on the attribute on the same element the <specval> is within. Thissyntax says you want something "EQual" to a delimited "%".


    I tried this on one of my SGML documents and it worked fine, so I would expect it would work on your XML as well.


    Hope this helps,


    Bob

    kmccainAuthor
    Feb 26, 2014 5:38 PM UTC

    Lynn - I am just trying to spit out a generated % sign when the writer chooses the attribute value "%" for a quantity UOM. It is S1000D procedural DMs and the schema uses the "%" for the attribute value so I can't change it 😞 I am using FOSI to develop print output for their review PDFs. This is the only unit that doesn't work and I figured it is because it was a reserved character. Just looking for a way around it.


    Bob - I will try that trick when I get back to the office and see what happens.


    Thanks, KM

    Feb 26, 2014 6:16 PM UTC
    Kim,



    In this case do not use <specval>, but use <fillval> and let the FOSI take
    the content of the attribute and display it. Here is an example



    <att>
    <fillval attname="YOUR-ATT" attloc="IF-NOT-CURRENT-ELEMENT" attval="#EQ#\%|"&lt;br"/>fillcat="usetext"
    fillchar="source">
    <charsubset>
    <usetext source="\%\"></charsubset>
    </att>



    Check out MIL-PRF-28001C or the annotated Epic file of MIL-PRF-28001BA1 in
    the tutorials folder in Epics default path. There is info on how to use the
    <fillval>.



    Lynn
    kmccainAuthor
    Feb 26, 2014 8:26 PM UTC

    Bob - I did try your suggestion, but the FOSI still complains about it not matching the enumerated value.


    Lynn - I tried your fillval suggestion and that actually works. Unfortunately, it works too well. For some reason, it is also displaying the attribute value for every specval I have defined as well. So except for the % value (which is displayed just once), I am getting the attribute value + the usetext value displayed on the page - like this: V V or in in etc.. I'm not sure why. I will read that document you referred to.

    Feb 26, 2014 9:13 PM UTC
    Try changing the <usetext> to a <savetext> and then call the 'textid' where
    you need to have the % show up.



    Lynn




    Feb 27, 2014 12:07 AM UTC
    Kim,

    How is the attribute declared in the DTD?

    The following works for me. The role attribute is CDATA.

    <att>
    <specval attname="role" attval="%">
    <charsubset>
    <usetext source="\%\"></usetext>
    </charsubset>
    </att>

    Good luck!
    Suzanne Napoleon
    www.FOSIexpert.com
    "WYSIWYG is last-century technology!"