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

attribute value with percent sign

kmccain
3-Visitor

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 13

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,

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


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

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


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

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

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

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.

Try changing the <usetext> to a <savetext> and then call the 'textid' where
you need to have the % show up.



Lynn




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!"

It is a schema: it is declared like this -


<xs:attribute name="quantityUnitOfMeasure" type="quantityUnitOfMeasureAttType"/">
<xs:simpletype name="quantityUnitOfMeasureAttType">
<xs:restriction base="xs:string">


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



KM

Kim,



I still think that the <fillval> is the route you want to go. The example I
passed to you yesterday had one error (and really should not have worked).
Here is an example of a <fillval> that I know has worked in the past.

<fillval attname="pretext" fillcat="usetext" fillchar="source">



In your case, the 'attname' would be "quantityUnitOfMeasure". The 'attloc'
would be used if the attribute is not in the current element. There is NO
'attval' in <fillval> (my mistake the last time).



I looked at the S1000D version 4 schema. There are nearly 1,300 allowable
values for the "quantityUnitOfMeasure" of which "%" is one of them. So if
you want to display the value of the attribute in your output, the <fillval>
is your best bet.



Now if you are only wanting to show those elements where the attribute value
is "%". Then a mix of a <specval> and <fillval> should work for you.

If you like, we can take this offline.

Lynn


Lynn - Yes, I realized that the attval was invalid.


My problem is that although it would be easier to just use a fillval to generate the text for every possible value of the attribute by using the value of the source, there are many exceptions where the attribute value is not what is wanted for display, e.g., instead of "deg" they want to see the degree symbol, instead of the word "plus" it should be the plus symbol, etc. That's why I went with individual specvals to determine the content for display even though it was a tedious way to do it. I'm no FOSI expert so I probably am doing things the wrong way around.


If you can help me get just this percent sign working, I'd be glad to take it offline.Do you need my email address?


KM

Announcements