XMetaL Tips and Tricks

XMetaL Community Forum XMetaL Tips and Tricks Tutorial: Checking links ("where used") using a text search utility

  • Su-Laine Yeo

    Tutorial: Checking links ("where used") using a text search utility

    Participants 1
    Replies 0
    Last Activity 13 years, 9 months ago

    It is often helpful to know where a particular piece of content is used or referenced. For example, if you have a warning that is used in multiple documents, you might want to see what documents use the warning before making changes to it. Some content management systems (CMS) have features to do this type of checking. If you don't have a CMS, one way to see where a file or element is used is to use a text search utility. Lightweight text search utilities that will do the job include PSPad (freeware, [url=http://www.pspad.com/]http://www.pspad.com/[/url]) and Windows Grep ($30, shareware, [url=http://www.wingrep.com/]http://www.wingrep.com/[/url] ).

    This tutorial describes how to search for the files that reference DITA content, using PSPad. The concepts here can also be applied to other DTDs and to other text search utility software. This tutorial refers to sample files that are installed with XMetaL Author Enterprise 5.1 or 5.5.

    Searching for DITA maps that reference a topic
    DITA maps contain elements pointing to topics. Each has an “href” attribute whose value includes the file name of the topic. To find which map files reference the topic, search for files that contain the file name of the topic.

    1. Start PSPad.
    2. Click Search > Search/Replace in Files.
    3. Make the dialog look like this:

    [img]http://img78.imageshack.us/img78/1857/pspadsearchfilenamevc5.png[/img]

    4. Click OK. The system searches for all files with extension “.ditamap” that contain the string “Add_Account.xml” in the C:Program FilesXMetaL 5.5 folder. The C:Program FilesXMetaL 5.5 folder is used in this tutorial because it is where sample files are installed. If you were doing a real search, you would choose a folder that contains your actual map files, such as your My Documents folder.

    5. Click the Search in File Results tab near the bottom of the window.
    The search results show that the topic is referenced twice by one DITA map file (one of the elements is in the hierarchical part of the map, and the other is in a relationship table).

    [img]http://img360.imageshack.us/img360/8506/pspadsearchresultsditamnk9.png[/img]

    Searching for conrefs and cross-references that reference an element
    DITA (cross-reference) elements contain an “href” attribute whose value includes the ID of the element that the cross-reference points to. DITA conref attributes (used for transcluding a piece of content to a different location) include the ID of the element that is being transcluded.  To find where an element is being referenced by conref or , search for files that contain the ID of that element.

    In this example, you will find where a particular Reusable Component is used. The target element is the element in the file here: C:Program FilesXMetaL 5.5AuthorSamplesDITAReusable_ComponentsXMetaL_Reviewer.xml . This procedure finds the topics that have conref attributes pointing to that target element.

    1. Using XMetaL, open the XMetaL_Reviewer.xml file found here: C:Program FilesXMetaL 5.5AuthorSamplesDITAReusable_Components .
    2. Switch to Tags On view, and place your cursor in the element, as shown.

    [img]http://img71.imageshack.us/img71/1493/reusablecomponentwd1.png[/img]

    3. Click View > Attribute Inspector. The “id” field in the Attribute Inspector shows the ID of the element. Copy this ID.

    [img]http://img520.imageshack.us/img520/1356/aiap7.png[/img]

    4. Start PSPad.
    2. Click Search > Search/Replace in Files.
    3. Make the dialog look like this (you can paste the ID that you copied from the Attribute Inspector):

    [img]http://img520.imageshack.us/img520/3276/pspadsearchidhj0.png[/img]

    4. Click OK. The system searches for all files with extension “.xml” that contain the string “ph_BC5271148E66415AAFD5F21793E18779” in the C:Program FilesXMetaL 5.5 folder.

    [img]http://img520.imageshack.us/img520/1486/pspadsearchresultsconrelv4.png[/img]

    Six of the 7 search results contain conrefs that point to the Reusable Component. One of the search results is the Reusable Component itself.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support