[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: a weird bug today, tree seems to change mid transf
Abel Braaksma wrote:
bryan rasmussen wrote:I don't have access to the code that is doing it, but it Just thinking out loud here, but what happens if you do a copy-preprocessing and then re-apply the templates to the msxml:nodeset of the result? That way you force your XSLT to operate on a copy of the input object and there can be no tampering in-between anymore: <xsl:template match="/"> <xsl:variable name="copy"> <xsl:apply-templates mode="copy" /> </xsl:variable> <xsl:apply-templates select="msxml:nodeset($copy)" /> </xsl:template> <xsl:template match="node() | @*" mode="copy"> <xsl:copy> <xsl:apply-templates select="node() | @*" mode="copy" /> </xsl:copy> </xsl:template> <xsl:template match="*" mode="copy"> <xsl:copy> <xsl:attribute name="original-id"><xsl:value-of select="generate-id()" /></xsl:attrribute> <xsl:apply-templates select="node() | @*" mode="copy" /> </xsl:copy> </xsl:template> <xsl:template match="node() | @*" > <xsl:copy> <xsl:apply-templates select="node() | @*" mode="copy" /> </xsl:copy> </xsl:template> <xsl:template match="*" > <xsl:copy> <xsl:attribute name="new-id"><xsl:value-of select="generate-id()" /></xsl:attrribute> <xsl:apply-templates select="node() | @*" mode="copy" /> </xsl:copy> </xsl:template> <xsl:template match="x"> <xsl:copy> <xsl:attribute name="new-id"><xsl:value-of select="generate-id()" /></xsl:attrribute> <xsl:variable .... do your thing with @x /> ... do some more with x here ... <xsl:apply-templates select="node() | @*" mode="copy" /> </xsl:copy> </xsl:template> Now your output should also contain, on each node, the attributes "original-id" and "new-id". These should be *different* for each and every node!!! You may take this step even a bit further to see if attributes are treated differently: <xsl:template match="*"> <xsl:for-each select="@*"> <xsl:copy /> <xsl:attribute name="{concat('id-of-attr-', name())}" /> </xsl:for-each> </xsl:template> do the same for the copy mode. It will get quite messy, but you will get some insight in what is going on under the hood.... (meaning: you will get insight when generated ids are equal and you know it is an MS bug, you won't get insight if all ids are different as they should be). Hopefully, the copy trick, which is an easy workaround, can be applied to all your stylesheets, if it indeed works. It is bad, but not that bad as a hack per issue (like your following-sibling trick). Cheers, -- Abel Braaksma
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|