Subject: Collect all the nodes with a specified gi... ¿ ? From: Reyes Garcia Rosado <reyes.garcia@xxxxxxxxxx> Date: Fri, 01 Oct 1999 09:40:47 +0200 |
Hello! I need to take from a tree (SGML instance) all the nodes that have a specified gi. I explin it: I have a SGML instance from a DTD like this: |-- SON-AA |-- SON-A-----|-- *KEY | |-- *SON-AB | FATHER------|-- SON-B | | |-- SON-CA-----KEY |-- SON-C-----|-- *SON-CB | |-- SON-CCA |-- *SON-CC-----| |-- *KEY and I want to make, with Jade, a SGML instance from the next DTD: |-- COLLECT------ *KEY | | |-- SON-AA |-- SON-A-----|-- *KEY | |-- *SON-AB FATHER------| |-- SON-B | | |-- SON-CA-----KEY |-- SON-C-----|-- *SON-CB | |-- SON-CCA |-- *SON-CC-----| |-- *KEY My problem is collect all the tags with the gi "KEY" (in this case). I have made two procedures (they work good): (element FATHER (make element gi: (gi (current-node)) (let ((Keys (filter-by-gi (current-node) '("KEY")))) (make sequence (make element gi: "COLLECT" (process-collect-key Keys)) (process-children) ) ) ) ) (define (filter-by-gi nodelist gilist) (let loop ((final (empty-node-list)) (nl nodelist)) (if (node-list-empty? nl) final (loop (node-list final (node-list-filter-by-gi nl gilist)) (children nl)) ) ) ) (define (node-list-filter-by-gi nodelist gilist) (let loop ((result (empty-node-list)) (nl nodelist)) (if (node-list-empty? nl) result (if (member (gi (node-list-first nl)) gilist) (loop (node-list result (node-list-first nl)) (node-list-rest nl)) (loop result (node-list-rest nl)) ) ) ) ) But, there is a direct way to make this? Thanks, Reyes DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: XSL equivalent sought., Matthias Clasen | Thread | RE: Collect all the nodes with a sp, Pieter Rijken |
RE: XSL equivalent sought., DPawson | Date | RE: Collect all the nodes with a sp, Pieter Rijken |
Month |