View Single Post
Join Date: Oct 2008
Posts: 22
Reputation: mlohokare is an unknown quantity at this point 
Solved Threads: 0
mlohokare mlohokare is offline Offline
Newbie Poster

Re: PLMXML to generic xml

 
0
  #4
Dec 8th, 2008
Hi,

After some modifications you can get the attribute value....

only modified code is as below....

  <xsl:template name="PLMXML">
    <xsl:element name="GXML">
      <xsl:if test="/plm:PLMXML/plm:Product">
		  <xsl:for-each select="plm:PLMXML/plm:Product"> <!-- to check all the child nodes otherwise you can see only 1 and very first node -->
        <xsl:call-template name="Product">
			<xsl:with-param name="ids" select="./@id"/> <!-- If you want to check 1 and no other nodes you can remove for-each and rewrite as <xsl:with-param name="ids" select="plm:PLMXML/plm:Product/@id"/> -->
        </xsl:call-template>
		</xsl:for-each>
      </xsl:if>
    </xsl:element>
  </xsl:template>
  
  <!--Start Of the Product Template-->
  <xsl:template name="Product">
    <xsl:param name="ids" />
    <xsl:element name="Item">
      <xsl:attribute name="id">
        <xsl:value-of select="$ids"/>
      </xsl:attribute>

      <xsl:for-each select="/plm:PLMXML/plm:ProductRevision">
        <xsl:call-template name="ProductRevision"/>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>

************
Output for for-each as below...

<GXML>
<Item id="id2"/>
<Item id="id3"/>
</GXML>
************
output without for-each as below
<GXML>
<Item id="id2"/>
</GXML>
************

If that works please mark this thread as solved.

Cheers,
Mahesh
Reply With Quote