Select Rules |
Select rules are used with structured file formats such as XML and JSON. The rules specify what element should be localized. Rules contain one or more select rules. Each rule selects one element type. The rue contains the following properties.
Property | Description | Example | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value expression | XPath expression that specifies the element to be localized. | description //description //data/description @description data@description |
||||||||||||||||||||||||||||||||||||||||||
Id expression | Optional XPath expression that specifies the element giving the id of the element specified in the Value property. Must be a relative XPath to the value element. |
@id ../@key |
||||||||||||||||||||||||||||||||||||||||||
Give only id, do not localize | If checked, the rule specifies the id of the value element but does not make the element for localization. | |||||||||||||||||||||||||||||||||||||||||||
Localize expression | Optional XPath expression that specifies the element showing if the element specified in the Value property should be localized. Must be a relative XPath to the value element. |
@localize ../@localize |
||||||||||||||||||||||||||||||||||||||||||
Data format | The data format of the element. By default this is Detect, that means Soluling will detect the format. You can also select the format:
|
Use XPath in expressions. Currently, only a subset of XPath is allowed. You can use "/"
, "."
, ".."
, "@"
and element names. For example description
selects all elements having description as a name. @caption
selects all attributes having caption as a name.
Let's have an example.
<?xml version="1.0" encoding="utf-8"?> <products> <product id="skimmilk"> <name>Skim milk</name> <price>1.15</price> <count>1</count> </product> <product id="apple"> <name>Apple</name> <price>0.99</price> <count>10</count> </product> </products>
We want to localize the name elements in the file. The id attribute of the product element contains a unique id that we can use as an id element. Our rule will be
Value expression | name |
Id expression | ../@id |