hvroosmalen Posted October 16, 2014 Share Posted October 16, 2014 Hello, I tried to replace the value of one element with the value of a precedent. Xml Source = Form02.xml ArticleList with two times an Article <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <Interface> <DatabasePath>mi-erp03sofonDevelopSPO</DatabasePath> - <ArticleList> - <Article> <Description>B110.226060.101.00477 - VARICONM CONFIG 7047</Description> <ArticleNumber>B110.226060.101.00477</ArticleNumber> <PositionDescription>1 - B110.226060.101.00477 - VARICONM CONFIG 7047</PositionDescription> <CostPrice>514.60</CostPrice> <CostPriceQuantity>1.00000000</CostPriceQuantity> <Unit>PCS</Unit> <ListPrice>1793.18</ListPrice> <SellPrice>1793.18</SellPrice> <AX_IDC_ConfigId>MPQ00477_1_0_1</AX_IDC_ConfigId> <AX_IDC_Name>B110.226060.101.00477 - VARICONM CONFIG 7047</AX_IDC_Name> <AX_ItemName>VARICONM CONFIG 7047</AX_ItemName> <AX_IVT_Template>SOFON-IT-VARICONM</AX_IVT_Template> <AX_Visible>true</AX_Visible> <GenericArticleNr>B110.226060.101.00477</GenericArticleNr> </Article> - <Article> <Description>B110.226060.102.00477 - VARICONM CONFIG 7047</Description> <ArticleNumber>B110.226060.102.00477</ArticleNumber> <PositionDescription>1 - B110.226060.102.00477 - VARICONM CONFIG 7047</PositionDescription> <CostPrice>514.60</CostPrice> <CostPriceQuantity>1.00000000</CostPriceQuantity> <Unit>PCS</Unit> <ListPrice>1793.18</ListPrice> <SellPrice>1793.18</SellPrice> <AX_IDC_ConfigId>MPQ00477_1_1_2</AX_IDC_ConfigId> <AX_IDC_Name>B110.226060.102.00477 - VARICONM CONFIG 7047</AX_IDC_Name> <AX_ItemName>VARICONM CONFIG 7047</AX_ItemName> <AX_IVT_Template>SOFON-IT-VARICONM</AX_IVT_Template> <AX_Visible>false</AX_Visible> <GenericArticleNr>B110.226060.102.00477</GenericArticleNr> </Article> </ArticleList> </Interface> XSL code = form02.xsl (renamed to form02xsl.txt in de Attach) <?xml version="1.0" encoding="utf-8" ?> - <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" /> <xsl:variable name="hans" /> - <xsl:template match="/"> - <Interface> <xsl:apply-templates select="Interface/DatabasePath" /> - <ArticleList> <xsl:apply-templates select="Interface/ArticleList/Article" /> </ArticleList> </Interface> </xsl:template> - <xsl:template match="Article"> - <Article> - <xsl:for-each select="*"> - <xsl:choose> - <xsl:when test="name() = 'AX_IDC_ConfigId'"> - <AX_IDC_ConfigId> <xsl:value-of select="//ArticleNumber" /> </AX_IDC_ConfigId> </xsl:when> - <xsl:otherwise> - <xsl:element name="{name()}"> <xsl:value-of select="." /> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:for-each> </Article> </xsl:template> </xsl:stylesheet> Result = out2.xml <?xml version="1.0" encoding="UTF-8" ?> - <Interface> mi-erp03sofonDevelopSPO - <ArticleList> - <Article> <Description>B110.226060.101.00477 - VARICONM CONFIG 7047</Description> <ArticleNumber>B110.226060.101.00477</ArticleNumber> <PositionDescription>1 - B110.226060.101.00477 - VARICONM CONFIG 7047</PositionDescription> <CostPrice>514.60</CostPrice> <CostPriceQuantity>1.00000000</CostPriceQuantity> <Unit>PCS</Unit> <ListPrice>1793.18</ListPrice> <SellPrice>1793.18</SellPrice> <AX_IDC_ConfigId>B110.226060.101.00477</AX_IDC_ConfigId> <AX_IDC_Name>B110.226060.101.00477 - VARICONM CONFIG 7047</AX_IDC_Name> <AX_ItemName>VARICONM CONFIG 7047</AX_ItemName> <AX_IVT_Template>SOFON-IT-VARICONM</AX_IVT_Template> <AX_Visible>true</AX_Visible> <GenericArticleNr>B110.226060.101.00477</GenericArticleNr> </Article> - <Article> <Description>B110.226060.102.00477 - VARICONM CONFIG 7047</Description> <ArticleNumber>B110.226060.102.00477</ArticleNumber> <PositionDescription>1 - B110.226060.102.00477 - VARICONM CONFIG 7047</PositionDescription> <CostPrice>514.60</CostPrice> <CostPriceQuantity>1.00000000</CostPriceQuantity> <Unit>PCS</Unit> <ListPrice>1793.18</ListPrice> <SellPrice>1793.18</SellPrice> <AX_IDC_ConfigId>B110.226060.101.00477</AX_IDC_ConfigId> <AX_IDC_Name>B110.226060.102.00477 - VARICONM CONFIG 7047</AX_IDC_Name> <AX_ItemName>VARICONM CONFIG 7047</AX_ItemName> <AX_IVT_Template>SOFON-IT-VARICONM</AX_IVT_Template> <AX_Visible>false</AX_Visible> <GenericArticleNr>B110.226060.102.00477</GenericArticleNr> </Article> </ArticleList> </Interface> As you see the value in the second Article/AX_IDC_ConfigId element is B110.226060.101.00477 in stead of B110.226060.102.00477. How do I get the correct value in de second Article/AX_IDC_ConfigId element. Thanks in advance Hans van Roosmalen From02.xml out02.xml From02bat.txt From02xsl.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now