×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

xml from Team Center and conforming with XLST

xml from Team Center and conforming with XLST

xml from Team Center and conforming with XLST

(OP)
Using XSLT, is it possible to match on values between disparate xml nodes and to combine related data in new XML output?

Objective: To update xml output from Teamcenter, using XSLT, to join together information that is directly related but from separate nodes. So that it is feasible to preview the xml data in an xml reader, to view the data logically grouped together. I give an example below of what I'm asking: The ask is if it's possible.

Note all the xml from Siemen's tool is in something called pmlxml. Ignore that fact and just think of it as standard xml format, albeit it's all attribute based, no elements whatsoever.

Example; I can provide real pmlxml as an example if wanted, but below is representative of the ask and simplifies what I'm trying to ascertain: If possible or not:

<xml>

<topNode>

<Part ID="2", DieType="Draw", Name="Cross Piece">
<NodeA ID="1", yada="red", yada="1.444" />
</Part>

<Part ID="3", DieType="Trim", Name="Support">
<NodeA ID="1", yada="red", yada="1.444" />
</Part>

<Brick ID="4", PartID="2", Name="Layers">
<brickfurthernode id="2", yada = "value" />
</Brick

</topNode>

Run through XSLT… and based on pk and fk relationship, such as on <part ID = "2">, combine information as thus:

<xml>
<Brick ID="4", PartID="2", PartName = "Cross Piece" Name="Layers">

</Brick


RE: xml from Team Center and conforming with XLST

Stephen,

In short, yes. This is a way to achieve this:

CODE --> XML

<?xml version="1.0" encoding="UTF-8"?>
<topNode>
  
  <Part ID="2" DieType="Draw" Name="Cross Piece">
    <NodeA ID="1" yada="red" yadayada="1.444" />
  </Part>
  
  <Part ID="3" DieType="Trim" Name="Support">
    <NodeA ID="1" yada="red" yadayada="1.444" />
  </Part>
  
  <Brick ID="4" PartID="2" Name="Layers">
    <brickfurthernode id="2" yada = "value" />
  </Brick>
  
</topNode> 

CODE --> XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/topNode">
    <xsl:element name="transformed">
      <xsl:apply-templates select="Brick" />
    </xsl:element>
  </xsl:template>

  <xsl:template match="Brick">
    <xsl:element name="Brick">
      <xsl:copy-of select="attribute::*"/>
      <xsl:attribute name="PartName"><xsl:value-of select="//Part[@ID = current()/@PartID]/@Name"/></xsl:attribute>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet> 

Resulting in:

CODE --> XML

<?xml version="1.0" encoding="utf-8"?>
<transformed>
   <Brick ID="4" PartID="2" Name="Layers" PartName="Cross Piece" />
</transformed> 

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