[plt-scheme] SXML or XEXPR? SXML pattern-matching?

From: Anton Tayanovskyy (anton.tayanovskyy at gmail.com)
Date: Mon Jun 23 13:02:27 EDT 2008

Hi group,

My question is - how do you usually pattern-match XML? With built into
PLT Scheme XML objects, Xexpr'essions, SXML, sxml-match, or PLT's
default pattern matcher? I can cope with either, I am just curious,
being new to Scheme, what is the best practice. I might be missing the

What I am doing is some XML transformations with PLT Scheme 4. A
wonderful change after XSLT. But it was a bit hard to decide between
Xexpr and the Lizorkin's SXML library; I settled on the latter as it
seems easier. However, what I would really appreciate is a
pattern-matcher for either of these representations. I have seen the
sxml-match library and it is quite powerful but afaik it is not
integrated into the PLT pattern language.

I guess what I am looking for is sxml-match.ss functionality as a PLT
match-expander, primarily the ability to match tag attributes
regardless of their order, with semantics like:

(match '(div (@ (id "header"))) "header-body")
 [(</> 'div (@ ,id ,(title "title")) (list body))
  (list id title body)]) ; gives ("header" "title" "body")

where </> is a 2- or 3-parameter match expander I defined, here:



Posted on the users mailing list.