How to Get an Element with a Specific xml:id Value Using JavaScript querySelector()
This is a memo on how to get an element with a specific xml:id value using JavaScript’s querySelector(). Specifically, for a variable called myDoc, you can retrieve the element as follows. This example gets the element with the value abc in its xml:id attribute. myDoc.querySelector("[*|id=‘abc’]") The key point is to specify it in the format *|(pipe)id. When working with TEI/XML files in JavaScript, there are cases where you need to retrieve elements using xml:id attribute values. Unlike other attributes such as type or corresp, the xml:id attribute has the prefix “xml:” in its attribute name. Therefore, you need to use the approach described above. ...

![[FOSS Memo] CollectiveAccess](/images/articles/hatena-2021-07-25-074624.png)