Hi everyone, I've spend quite a bit of time during the past days trying out the possible solutions for the Fragment identification. The first conclusion is that implementing any of the proposed options is not easy at all. The second conclusion is that, in my opinion, Fredrik's proposal with Dave's tweaking (see
https://lists.oasis-open.org/archives/xliff/201312/msg00096.html ) is the best solution so far. I've tried to express the whole thing as a draft text for the specification, cleaning up the BNF grammar and listing the constraints. The draft is the document attached. Attached files: - withReferences.xlf : an example file - prefixes.properties : a possible registry file for the prefixes - fragid.docx : draft for Fragment Identification section, and a few TODOs But most importantly I've also tried to implement it in the experimental Okapi XLIFF library and added three commands to Lynx to see how that would work with real files and scenarios. -- The -vr command verifies all the annotations references in the given document. For each <mrk> ref attribute it does the following: - validates the syntax - tries to fetch the reference if the reference is within the same document - if it's outside it indicates that and also indicates if the URI is a XLIFF fragment identifier or not -- The -fr command finds a given reference in the give document. The reference is validated. If the corresponding element can be found Lynx displays the type of object it corresponds to in the parsed document, as well as a few attributes for that object. -- The -lp command displays a list of all the module/extension prefixes recognized. In the three commands you can use the option -prefixes to specify a properties file where you can declare prefixes not defined in the pre-defined mapping (which is a properties file in the jar). See the readme.html file of the toolkit to get more details on the properties file format and the -prefixes option. I've copied some example of commands at the bottom of this email. The withReferences.xlf file used for the example is attached. I encourage you to get the latest version (link is below) and play with those commands to see if the syntax you would expect to use externally or internally works as you think and whether the references validate (or don't) as you expect. Between the -vr and the -fr commands you should be able to test both resolving references from outside of the document as well as from inside, including across <file> or <group> or <unit> and using modules or extensions. You can download the toolkit here:
http://okapi.opentag.com/snapshots/okapi-xliffLib_all-platforms_0.21-SNAPSHOT.zip Cheers, -yves Examples of command outputs: C:> lynx -vr withReferences.xlf ------------------------------------------------------------------------------- Okapi Lynx - Testing Tool for XLIFF 2.0 Library version: 0.21-SNAPSHOT ------------------------------------------------------------------------------- Input: C:withReferences.xlf - File=f1, Unit=2, annotation=m1 (source) ref="#f=f1/res=r1": Valid syntax. Reference found (net.sf.okapi.lib.xliff.core.ExtendedElement at "f=f1/res=r1") - File=f2, Unit=u1, annotation=m1 (source) ref="#g=g1/n=n1": Valid syntax. Reference found (net.sf.okapi.lib.xliff.core.Note at "f=f2/g=g1/n=n1") - File=f2, Unit=u1, annotation=m2 (source) ref="
http://en.wikipedia.org/wiki/Comment": Valid syntax. External non-XLIFF reference. - File=f2, Unit=u1, annotation=m3 (source) ref="#f=f1/n=globalNote1": Valid syntax. Reference found (net.sf.okapi.lib.xliff.core.Note at "f=f1/n=globalNote1") - File=f2, Unit=u1, annotation=m4 (target) ref="#n=n1": Valid syntax. Reference found (net.sf.okapi.lib.xliff.core.Note at "f=f2/u=u1/n=n1") - File=f2, Unit=u1, annotation=m5 (target) ref="myFile.xml#f=1/n=n1": Valid syntax. External XLIFF reference. - File=f2, Unit=u1, annotation=m6 (target) ref="someFile.xml#id1": Valid syntax. External non-XLIFF reference. C:> lynx -lp ------------------------------------------------------------------------------- Okapi Lynx - Testing Tool for XLIFF 2.0 Library version: 0.21-SNAPSHOT ------------------------------------------------------------------------------- Extensions and modules prefixes allowed in fragment identifiers: - "res" = "urn:oasis:names:tc:xliff:resourcedata:2.0" - "gls" = "urn:oasis:names:tc:xliff:glossary:2.0" - "mtc" = "urn:oasis:names:tc:xliff:matches:2.0" C:> lynx -fr #f=f2/n=n1 withReferences.xlf ------------------------------------------------------------------------------- Okapi Lynx - Testing Tool for XLIFF 2.0 Library version: 0.21-SNAPSHOT ------------------------------------------------------------------------------- Input: C:withReferences.xlf Searching for a note in a file ("#f=f2/n=n1") Object found: net.sf.okapi.lib.xliff.core.Note Some of the note information: - id = n1 - priority = 1 - content = "note for file (f2)" Attachment: withReferences.xlf Description: Binary data Attachment: prefixes.properties Description: Binary data Attachment: fragid.docx Description: application/vnd.openxmlformats-officedocument.wordprocessingml.document