Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F2730831
xml-query.xreate
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 14, 1:24 AM
Size
935 B
Mime Type
text/plain
Expires
Mon, Mar 16, 1:24 AM (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
243682
Attached To
rXR Xreate
xml-query.xreate
View Options
XmlNode = type {
tag: string;
attrs: [string];
content: string}.
Tree = type(Leaf) Tree [Leaf; [Tree(Leaf)]].
XmlTree = Tree(XmlNode).
query = function(tree: XmlTree): [XmlTree]
{
children : context(children) =
case default
[]
case (tree[0]: NeedChildren(childrenFilters), ApplyTransform(transFilters))
{
loop fold (tree[1]->child: Tree(Leaf) | childrenFilters; []->accum).
{accum + traverse(child): cases(transFilters) };
}
node =
case (node.tag == "style:style"; class = node[attrs, "style:name"]; exists(class, ParaKnownClasses))
{
[class, node[attrs, "style:display-name"]];
}
case default
[] ;
Tree[node children] | node + children
}
/*
traverse = function(trees: [XmlTree]) : [XmlTree]
loop fold(trees->tree: Tree; []->acc)
acc + traverse(tree)
*/
Event Timeline
Log In to Comment