its_translate_rule_eval (struct its_rule_ty *rule, struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules,
+ as specified in <https://www.w3.org/TR/its20/#datacategories-defaults-etc>:
+ - Local usage: Yes
+ - Global, rule-based selection: Yes
+ - Default values: translate="yes" for elements,
+ translate="no" for attributes.
+ - Inheritance for element nodes: Textual content of element,
+ including content of child elements, but excluding attributes. */
struct its_value_list_ty *result;
result = XCALLOC (1, struct its_value_list_ty);
struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules,
+ as specified in <https://www.w3.org/TR/its20/#datacategories-defaults-etc>:
+ - Local usage: Yes
+ - Global, rule-based selection: Yes
+ - Default values: none
+ - Inheritance for element nodes: Textual content of element,
+ including content of child elements, but excluding attributes. */
struct its_value_list_ty *result;
result = XCALLOC (1, struct its_value_list_ty);
struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules,
+ as specified in <https://www.w3.org/TR/its20/#datacategories-defaults-etc>:
+ - Local usage: Yes
+ - Global, rule-based selection: Yes
+ - Default values: withinText="no"
+ - Inheritance for element nodes: none */
struct its_value_list_ty *result;
const char *value;
}
/* Doesn't inherit from the parent elements, and the default value
- is None. */
+ is "no". */
value = its_pool_get_value_for_node (pool, node, "withinText");
if (value != NULL)
its_value_list_set_value (result, "withinText", value);
struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules,
+ as specified in <https://www.w3.org/TR/its20/#datacategories-defaults-etc>:
+ - Local usage: Yes
+ - Global, rule-based selection: Yes
+ - Default values: space="default"
+ - Inheritance for element nodes: Textual content of element,
+ including attributes and child elements. */
struct its_value_list_ty *result;
struct its_value_list_ty *values;
const char *value;
struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules:
+ - Local usage: No
+ - Global, rule-based selection: Yes
+ - Default values: none
+ - Inheritance for element nodes: none */
struct its_value_list_ty *result;
const char *value;
struct its_pool_ty *pool,
xmlNode *node)
{
+ /* Evaluation rules:
+ - Local usage: Yes
+ - Global, rule-based selection: Yes
+ - Default values: escape="no" (handled in the caller)
+ - Inheritance for element nodes: Textual content of element,
+ including content of child elements, but excluding attributes. */
struct its_value_list_ty *result;
result = XCALLOC (1, struct its_value_list_ty);
{
const char *value;
+ /* A local attribute overrides the global rule. */
+ if (xmlHasNsProp (node, BAD_CAST "escape", BAD_CAST GT_NS))
+ {
+ char *prop;
+
+ prop = _its_get_attribute (node, "escape", GT_NS);
+ if (strcmp (prop, "yes") == 0 || strcmp (prop, "no") == 0)
+ {
+ its_value_list_append (result, "escape", prop);
+ free (prop);
+ return result;
+ }
+ free (prop);
+ }
+
/* Check value for the current node. */
value = its_pool_get_value_for_node (pool, node, "escape");
if (value != NULL)
value = its_value_list_get_value (values, "escape");
do_escape = value != NULL && strcmp (value, "yes") == 0;
- /* Consider also a locally declared 'gt:escape' attribute. */
- if (node->type == XML_ELEMENT_NODE
- && xmlHasNsProp (node, BAD_CAST "escape", BAD_CAST GT_NS))
- {
- char *prop = _its_get_attribute (node, "escape", GT_NS);
- if (strcmp (prop, "yes") == 0 || strcmp (prop, "no") == 0)
- do_escape = strcmp (prop, "yes") == 0;
- free (prop);
- }
do_escape_during_extract = do_escape;
/* But no, during message extraction (i.e. what xgettext does), we do
value = its_value_list_get_value (values, "escape");
do_escape = value != NULL && strcmp (value, "yes") == 0;
- /* Consider also a locally declared 'gt:escape' attribute. */
- if (xmlHasNsProp (node, BAD_CAST "escape", BAD_CAST GT_NS))
- {
- char *prop = _its_get_attribute (node, "escape", GT_NS);
- if (strcmp (prop, "yes") == 0 || strcmp (prop, "no") == 0)
- do_escape = strcmp (prop, "yes") == 0;
- free (prop);
- }
do_escape_during_extract = do_escape;
/* Like above, in its_rule_list_extract_text. */