Subject: [xsl] what am I doing wrong with except and intersect? From: Alex Muir <alex.g.muir@xxxxxxxxx> Date: Sun, 20 Mar 2011 12:48:40 +0000 |
Hi, I'm confused as to why I'm not able to get intersect and except to work with the following node sets. Given list of new an old office codes: <newOfficeCodeList>PT,BX,FR</newOfficeCodeList> <oldOfficeCodeList>BX,FR</oldOfficeCodeList> I create some node sets: <xsl:template name="codeListAsXML"> <xsl:param name="OfficeCodeList"/> <xsl:param name="OfficeCodeArgSeperator"/> <xsl:variable name="result" as="node()*"> <xsl:analyze-string select="$OfficeCodeList" regex="{$OfficeCodeArgSeperator}"> <xsl:non-matching-substring> <code> <xsl:value-of select="normalize-space(.)"/> </code> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:variable> <xsl:sequence select="$result"/> </xsl:template> The old set of office codes: <xsl:variable name="oldOfficeCodeListXML" as="node()*"> <xsl:call-template name="codeListAsXML"> <xsl:with-param name="OfficeCodeList" select="$oldOfficeCodeList"/> <xsl:with-param name="OfficeCodeArgSeperator" select="','"/> </xsl:call-template> </xsl:variable> The new set of office codes: <xsl:variable name="newOfficeCodeListXML" as="node()*"> <xsl:call-template name="codeListAsXML"> <xsl:with-param name="OfficeCodeList" select="$newOfficeCodeList"/> <xsl:with-param name="OfficeCodeArgSeperator" select="','"/> </xsl:call-template> </xsl:variable> I tried some different ways to get the except and or intersect in the following variables with the result following the ==> <newOfficeCodeList>PT,BX,FR</newOfficeCodeList> <oldOfficeCodeList>BX,FR</oldOfficeCodeList> <xsl:variable name="exceptOldNewOfficeCode" select="$newOfficeCodeListXML except $oldOfficeCodeListXML"/> ==> <exceptOldNewOfficeCode>PT BX FR</exceptOldNewOfficeCode> <xsl:variable name="intersectOldNewOfficeCode" select="$newOfficeCodeListXML intersect $oldOfficeCodeListXML"/> ==> <intersectOldNewOfficeCode/> <xsl:variable name="DSexceptOldNewOfficeCode" select="distinct-values($newOfficeCodeListXML[not(. = $oldOfficeCodeListXML)])"/> ==> <DSexceptOldNewOfficeCode>PT</DSexceptOldNewOfficeCode> <xsl:variable name="DSintersectOldNewOfficeCode" select="distinct-values($newOfficeCodeListXML[. = $oldOfficeCodeListXML])"/> ==> <DSintersectOldNewOfficeCode>BX FR</DSintersectOldNewOfficeCode> It would seem that the variables that use the distinct method are correct and the variables using except and intersect are incorrect. So what am I doing wrong? Regards -- Alex ----- Currently: Freelance Software Engineer 6+ yrs exp Previously: https://sites.google.com/a/utg.edu.gm/alex/ A Bafila, is two rivers flowing together as one: http://www.facebook.com/pages/Bafila/125611807494851 -- Alex ----- Currently: Freelance Software Engineer 6+ yrs exp Previously: https://sites.google.com/a/utg.edu.gm/alex/ A Bafila, is two rivers flowing together as one: http://www.facebook.com/pages/Bafila/125611807494851
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Why namespace-alias resul, David Carlisle | Thread | Re: [xsl] what am I doing wrong wit, Martin Honnen |
Re: [xsl] Date and Time of a File, Florent Georges | Date | Re: [xsl] what am I doing wrong wit, Martin Honnen |
Month |