hfeldma1 |
Newbie |
|
Canada |
|
|
None Specified |
|
Friday, September 2, 2016 |
Friday, September 23, 2016 6:14:57 PM |
4 [0.02% of all post / 0.00 posts per day] |
|
Thank you so much, works like a charm.
|
I have the following set of variables
Code: <xsl:variable name="LookupLTE" select="document('HuaweiLTE.xml')/Huawei"/> <xsl:variable name="LookupHSPA" select="document('HuaweiHSPA.xml')/Huawei"/> <xsl:variable name="LookupDoc" select="if (substring($DeviceName,1,1)='L') then $LookupLTE else if (substring($DeviceName,1,1)='H') then $LookupHSPA else ()"/>
I get an XPTY0004 error of for the following
Code:<xsl:value-of select="key('table-lookup', $curr_key, $LookupDoc)/@ColumnName"/>
And yet the following works just fine?
Code:<xsl:value-of select="key('table-lookup', $curr_key, $LookupLTE)/@ColumnName"/>
|
Good point, so a sample input (i.e. $curr_key) to the document lookup would be
Code:LTHAB0113422/Cell:eNodeB Function Name=LTHAB0113422, Local Cell ID=0, Cell Name=LTHAB0113422-000-2100-1-1, eNodeB ID=113422, Cell FDD TDD indication=CELL_FDD/CnOperator:CnOperatorId=0
This should match with the first element (Key1) in the sample document posted. Does XSLT 3.0 maybe support this?
|
I'm familiar with using lookup document in XSLT, however I'm hoping it's possible to do the lookup using regex? I've attached a sample from the lookup document:
Code:<Telsa xmlns:xs="http://www.w3.org/2001/XMLSchema"> <Row Key1="^[A-Z0-9]+/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=[0-9]+, Cell Name=.*/CnOperator:CnOperatorId=[0-9]+$" ElementType="CELL_CORE_OPERATOR" RegexReplace="'^([A-Z0-9]+)/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=([0-9]+), Cell Name=.*/CnOperator:(CnOperatorId=[0-9]+)', '$1/CELL:$2/$3'"></Row> <Row Key1="^\w+-\w+-\w+-\d+/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=[0-9]+, Cell Name=.*, eNodeB ID=[0-9]+, Cell.*$" ElementType="CELL" RegexReplace="'^\w+-\w+-\w+-\d+/Cell:eNodeB Function Name=([A-Z0-9]+), Local Cell ID=([0-9]+), Cell Name=.*, eNodeB ID=([0-9]+), Cell.*$', '$1/Cell:$2'"></Row> <Row Key1="^\w+-\w+-\w+-\d+/EthernetInterface:Ethernet Interface No.=.*$" ElementType="EthernetInterface" RegexReplace="'^(\w+-\w+-\w+-\d+)/EthernetInterface:Ethernet Interface No.=([0-9]+)$' , '$1/No=$2'"></Row> <Row Key1="^[A-Z0-9]+/CELL:Local cell identity=[0-9]+, Cell Name=.*/OPERATOR:CnOperatorId=[0-9]+$" ElementType="CELL_CORE_OPERATOR" RegexReplace="'^([A-Z0-9]+/CELL:)Local cell identity=([0-9]+), Cell Name=.*/OPERATOR:(CnOperatorId=[0-9]+)' , '$1$2/$3'"></Row> <Row Key1="^[A-Z0-9]+/Cell:Local cell identity=[0-9]+, Cell Name=.*, eNodeB identity=[0-9]+$" ElementType="CELL" RegexReplace="'^([A-Z0-9]+/Cell:)Local cell identity=([0-9]+), Cell Name=.*, eNodeB identity=[0-9]+$', '$1$2'"></Row> <Row Key1="^[A-Z0-9]+/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=[0-9]+, Cell Name=.*, eNodeB ID=[0-9]+$" ElementType="CELL" RegexReplace="'^([A-Z0-9]+)/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=([0-9]+), Cell Name=.*, eNodeB ID=([0-9]+)$', '$1/Cell:$2'"></Row> <Row Key1="^[A-Z0-9]+/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=[0-9]+, Cell Name=.*, eNodeB ID=[0-9]+$" ElementType="CELL" RegexReplace="'^([A-Z0-9]+)/Cell:eNodeB Function Name=[A-Z0-9]+, Local Cell ID=([0-9]+), Cell Name=.*, eNodeB ID=([0-9]+)$', '$1/Cell:$2'"></Row> </Telsa>
This is what I have defined in the XSLT for the lookup:
Code:<xsl:key name="table-lookup" match="Row" use="@Key1"/> <xsl:variable name="LookupDoc" select="document('Telsa.xml')/Telsa"/>
So my thinking is I need to change the following somehow, question is to what:
Code:<xsl:value-of select="key('table-lookup', $curr_key, $LookupDoc)/@ElementType"/>
|
|