This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 95669

Summary: Mapper doesn't take into accout the context when binds elements within xsl:for-each structure
Product: soa Reporter: Andrei Chistiakov <ca-nb>
Component: XSLTAssignee: Alexey Yarmolenko <alexeyyarmolenko>
Status: NEW ---    
Severity: blocker CC: kozlov
Priority: P2    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:

Description Andrei Chistiakov 2007-02-15 13:02:25 UTC
Reproduced in build 070214_22.

To reproduce the bug:

- create the xsl transformation of one PO schema to another PO schema;
- in order to process a set of <item> elements, use xsl:for-each rule in Mapper;
- in Mapper, bind the subcomponents of the source <item> element to the
corresponding components of the target <item>.

Notice that the generated xsl source looks like:
        <xsl:element name="ns:newPurchaseOrder">
            <xsl:element name="ns:items">
                <xsl:for-each select="/ns1:purchaseOrder/Items/item">
                    <xsl:element name="ns:item">
                        <xsl:attribute name="ns:partNum">
                            <xsl:value-of
select="/ns1:purchaseOrder/Items/item/@partNum"/>
                        </xsl:attribute>
                        <xsl:element name="ns:productName">
                            <xsl:value-of
select="/ns1:purchaseOrder/Items/item/productName"/>
                        </xsl:element>
                        <xsl:element name="ns:quantity">
                            <xsl:value-of
select="/ns1:purchaseOrder/Items/item/quantity"/>
                        </xsl:element>
                    </xsl:element>
                </xsl:for-each>
            </xsl:element>
        </xsl:element>

Mapper creates the absolute XPath expressions (starting with the root element).
The correct expressions should be related to the current node context, i.e.
        <xsl:element name="ns:newPurchaseOrder">
            <xsl:element name="ns:items">
                <xsl:for-each select="/ns1:purchaseOrder/Items/item">
                    <xsl:element name="ns:item">
                        <xsl:attribute name="ns:partNum">
                            <xsl:value-of select="@partNum"/>
                        </xsl:attribute>
                        <xsl:element name="ns:productName">
                            <xsl:value-of select="productName"/>
                        </xsl:element>
                        <xsl:element name="ns:quantity">
                            <xsl:value-of select="quantity"/>
                        </xsl:element>
                    </xsl:element>
                </xsl:for-each>
            </xsl:element>
        </xsl:element>
Comment 1 Alexey Yarmolenko 2007-02-16 08:58:54 UTC
We still have no handling for relative locationPath. To implement it we also
have to track the "current" node for XPath expression owner.