added XVARS^GPLXPATH to list unique variables in a template

This commit is contained in:
george 2008-09-21 21:57:04 +00:00
parent be5ef25081
commit 0c12f244f2
2 changed files with 16 additions and 0 deletions

View File

@ -204,4 +204,9 @@ GPLXPAT0 ; CCDCCR/GPL - XPATH TEST CASES ; 6/1/08
;;>>>D H2ARY^GPLXPATH("GTMP2","GTMP")
;;>>?GTMP2(0)=1
;;>>?GTMP2(1)="TEST1^1"
;;><XVARS>
;;>>>K GTMP,GTMP2
;;>>>D PUSH^GPLXPATH("GTMP","<VALUE>@@VAR1@@</VALUE>")
;;>>>D XVARS^GPLXPATH("GTMP2","GTMP")
;;>>?GTMP2(1)="VAR1^"
;;></TEST>

View File

@ -436,6 +436,17 @@ H2ARY(IARYRTN,IHASH) ; CONVERT IHASH TO RETURN ARRAY
. ; W @IARYRTN@(0),!
Q
;
XVARS(XVRTN,XVIXML) ; RETURNS AN ARRAY XVRTN OF ALL UNIQUE VARIABLES
; DEFINED IN INPUT XML XVIXML BY @@VAR@@
; XVRTN AND XVIXML ARE PASSED BY NAME
;
N XVI,XVTMP,XVT
F XVI=1:1:@XVIXML@(0) D ; FOR ALL LINES OF THE XML
. S XVT=@XVIXML@(XVI)
. I XVT["@@" S XVTMP($P(XVT,"@@",2))=""
D H2ARY(XVRTN,"XVTMP")
Q
;
TEST ; Run all the test cases
D TESTALL^GPLUNIT("GPLXPAT0")
Q