INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Reuse of Attributed Elements to make list?

## Reuse of Attributed Elements to make list?

(OP)
Fellow forum Members, the code below is an example of how S1000D XML handles ancronyms:

<acronym acronymtype="at01"> <acronymTerm>NASA</acronymTerm> <acronymDefinition id="acr-0001">National Aeronautics and Space Administration</acronymDefinition> </acronym>

My objective is to figure out what XML code functions as a lasso that retrieves the attribute acronymtype="at01" found within a lot of data modules and collects all of this attributed acronym element data in one common data module I'm calling "List Of Acronyms".

In other words, what XML mechanism should I be looking at if I want to reuse attributed data residing within many data modules and have it automatically gathered and reused in one common data module? I want to avoid the work of manually gathering all of the different acronyms residing within many data modules and building an acronym list manually. My goal is for my Acronym List to auto generate. Is this possible with Issue 4.01 of the S1000D schema? Any hints, help, tips greatly appreciated. Thanks in advance.

### RE: Reuse of Attributed Elements to make list?

You did not specify the operating environment in which all this data are swimming, so some generalities.

My first cut at gathering this information, assuming that all the XML documents are in a directory structure that is addressable, would be to use a scripting language to assemble an XML 'document of documents' and then use XSLT to process that document, using the XSLT document() function to extract all the useful nodes. Given my skill level, I would have it done in about 30 minutes. As someone new to XML, you have a bit of a learning curve.

I have to get busy on the day job right now, but have a look at the XSLT and XPath tutorials on www.w3schools.com. I will check back to see what progress you have made...

Tom Morrison
Hill Country Software

### RE: Reuse of Attributed Elements to make list?

(OP)
Tom,
Thanks for your reply. I am using a suite called Arbortext S1000D for Aerospace & Defense. It's made by PTC which is the same software company behind ProEngineer now called CREO. This suite is comprised of six main applications. The only apps I'm using from this suite are Arbortext, the Common Source Data Base (CSDB) module, and the Publisher Module. So to answer your question, all my data is swimming inside a CSDB.

You mention using a scripting language together with XLink might be the solution. However, I'm scratching my head how a script can be implemented either within the CSDB module or the Publisher module that will lasso all the data and populate my List of Acronyms Data Module. All the data modules are swimming within a CSDB and getting a script to run within the CSDB is where I see a potential problem. Thanks for the link. I have absorbing the XLink material and trying to figure out how it fits to what I want to do. Again thanks for the help.

### RE: Reuse of Attributed Elements to make list?

I had a look at the web site for the authoring/content management system you cited. Is my conjecture that it works on Windows. Correct?

Does the thing that looks like a database actually a directory structure containing all of the XML source artifacts? Or is the database storing the XML in a relational database?

In any event, what you need to be able to do is get all the XML documents that contain the acronyms into separate files, one XML document/file.

Then make an XML document (let's call it filelist.xml) that has the structure:

#### CODE --> XML

<files>
<file>path/to/file1.xml</file>
<file>path/to/file2.xml</file>
</files> 

Of course, I am presuming this file will contain dozens, hundreds (?), of <file> entries. This document becomes the input document for the following XSLT stylesheet.

Then, you would create an XSLT along the following general lines. (Warning, this is typed in without any testing.)

#### CODE --> XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>

<xsl:template match="/">
<acronymn-collection>
<xsl:apply-templates select="files/file"/>
</acronymn-collection>
</xsl:template>

<xsl:template match="files/file">
<xsl:comment> Pulling from <xsl:value-of select="."/> </xsl:comment>
<xsl:copy-of select="document(.)//acronym"/>
<xsl:comment> End of <xsl:value-of select="."/> </xsl:comment>
</xsl:template>

</xsl:stylesheet> 

This code simply copies all the <acronym> subtrees that it finds into the output without restructuring the subtree.

Ask questions... One possible minor complication is the use of XML namespaces in your documents. In a complex authoring system, I would suspect that, at a minimum, a default namespace is declared at or near the top of the XML document.

Tom Morrison
Hill Country Software

### RE: Reuse of Attributed Elements to make list?

#### Quote:

My objective is to figure out what XML code functions as a lasso that retrieves the attribute acronymtype="at01" found within a lot of data modules and collects all of this attributed acronym element data in one common data module I'm calling "List Of Acronyms".

I missed the subtlety of wanting only acronyms of a specific type. This changes one line in the XSLT, adding an XPath predicate so that only <acronym> nodes that have that specific acronymtype value are select for copying..

#### CODE --> XSLT

<xsl:copy-of select="document(.)//acronym[@acronymtype='at01']"/>

Tom Morrison
Hill Country Software

### RE: Reuse of Attributed Elements to make list?

(OP)
Tom,
Thank you very much for your posting. This weekend I am making plans to sit in front of my computer and experiment with the code you have provided and what I have learned from www.w3schools.com. Again thank you very much for your postings.

### RE: Reuse of Attributed Elements to make list?

Dear matrix01011,

Any progress?

Tom Morrison
Hill Country Software

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.21580153703689575, "perplexity": 4383.1325925612555}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2017-51/segments/1512948519776.34/warc/CC-MAIN-20171212212152-20171212232152-00619.warc.gz"}