×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

Reuse of Attributed Elements to make list?

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close