Skip to main content
1-Visitor
February 25, 2014
Question

attribute value with percent sign

  • February 25, 2014
  • 13 replies
  • 2371 views

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

    1-Visitor
    February 25, 2014
    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,

    1-Visitor
    February 25, 2014
    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


    kmccain1-VisitorAuthor
    1-Visitor
    February 26, 2014

    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

    1-Visitor
    February 26, 2014
    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


    1-Visitor
    February 26, 2014

    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

    kmccain1-VisitorAuthor
    1-Visitor
    February 26, 2014

    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

    1-Visitor
    February 26, 2014
    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
    kmccain1-VisitorAuthor
    1-Visitor
    February 26, 2014

    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.

    1-Visitor
    February 26, 2014
    Try changing the <usetext> to a <savetext> and then call the 'textid' where
    you need to have the % show up.



    Lynn




    1-Visitor
    February 27, 2014
    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!"