Subject: [xsl] Re: xsl:variable and creating conditional select From: "Hesselberth, Jan" <Jan.Hesselberth@xxxxxxxxxxxxxxxxxx> Date: Tue, 18 Mar 2003 15:33:57 -0000 |
>Hi everyone, >I have the following logical requirement > ><xsl:if test= "substring-after(.,' ')=''"> > <xsl:variable name="nextparent" select="parent::GROUP/@CategoryOrGroupParent"/> ></xsl:if> ><xsl:if test= "substring-after(.,' ')!=''"> > <xsl:variable name="nextparent" select="concat(substring-after(.,' '),' ',$ROOT)"/> ></xsl:if> > >I know this won't work as the variables go out of scope. >However, I can't figure out how to set the expression in the select of the xsl:variable to give me the required >results. >Any help would be greatly appreciated. >Cheers > Jan What I was trying to say was if the current node contains a space the variable nexttag should be set to the value of the current node plus ' ',$ROOT if the current node does not contain a space the variable nexttag should be the value of the current node plus ancestor::GROUP/@CategoryOrGroupParent So in <GROUP SimpleTypeName="SYS_Content" CategoryOrGroupParent="Block SubField SWIFT" Description="SWIFT 2002 v2.0" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Sending Time</RelativeTypeName> <Range Min="1" Max="1"/> </SequenceComponent> <SequenceComponent><RelativeTypeName>MIR</RelativeTypeName> <Range Min="1" Max="1"/> </SequenceComponent> </Sequence> </GROUP> nexttag would = MIR (from RelativeTypeName) Block SubField SWIFT (from CategoryOrGroupParent) and <GROUP SimpleTypeName="MT920" CategoryOrGroupParent="Category9 Output Message SWIFT" Description="SWIFT 2002 v2.0" OrderSubtypes="ASCENDING"><Sequence partition="NO"><Implicit/><SequenceComponent><RelativeTypeName>Basic Header Block</RelativeTypeName> <Range Min="1" Max="1"/> </SequenceComponent> <SequenceComponent><RelativeTypeName>User Header Block</RelativeTypeName> <Range Min="0" Max="1"/> </SequenceComponent> </Sequence> </GROUP> nexttag would = User Header Block (from RelativeTypeName) plus ' ' $ROOT I came up with this solution which seems to work but it's very complex <xsl:variable name="nextgroup" select="concat(substring(substring-before(.,' '),1, contains(.,' ') * string-length(substring-before(.,' '))),substring(substring(.,1),1,not(contains(.,' ')) * string-length(.)))"/> <xsl:variable name="nextparent2" select="substring(concat(substring-after(.,' '),' ',$ROOT),1,string-length(concat(substring-after(.,' '),' ',$ROOT))* not(not(substring-after(.,' '))))"/> <xsl:variable name="nextparent1" select="substring(ancestor::GROUP/@CategoryOrGroupParent,1,string-length(anc estor::GROUP/@CategoryOrGroupParent) * not(substring-after(.,' ')))"/> <xsl:variable name="nextparent" select="concat($nextparent1,$nextparent2)"/> <xsl:variable name="nexttag" select="concat($nextgroup,' ',$nextparent)"/> Thanks for the advice Jan -------------------------------------------------------------------------- CONFIDENTIALITY The information contained in this e-mail and any files transmitted with it is private and confidential. It is intended for the named addressee only. If you are not the intended addressee you are prohibited from storing, copying or using the information in any way. If you received this e-mail due to a transmission error please notify the sender immediately. No liability is accepted by Northern Rock for any losses caused by viruses contracted during transit over the Internet or present in any receiving system. This e-mail is not intended to create legally binding commitments on behalf of Northern Rock plc, nor do its contents reflect the corporate views or policies of Northern Rock plc. -------------------------------------------------------------------------- This message has been checked for all email viruses by the Energis NetscanCentral solution. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] formatting <xsl:number> f, Michael Kay | Thread | RE: [xsl] Re: Re: how to select ele, Passin, Tom |
RE: [xsl] Pictures in XML/XSL, John Proctor | Date | Re: AW: [xsl] Syntax Problem, David Carlisle |
Month |