<span style="font-family: courier new,monospace;">Adding some code to go along with my last post:<br><br>main = do</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [tree]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;- runX (readDocument [(a_validate, &quot;0&quot;)] &quot;
text.xml&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [</span><span style="font-family: courier new,monospace;">fooDoc</span><span style="font-family: courier new,monospace;">
] &lt;- runX (constA tree &gt;&gt;&gt; processChildren isFoo)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [expanded]&nbsp;&nbsp;&nbsp;&nbsp; &lt;- runX (constA tree &gt;&gt;&gt; processTopDown (expandNode fooDoc `when` hasName &quot;bar&quot;))
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [status]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;- runX (constA expanded &gt;&gt;&gt; writeDocument [] &quot;-&quot; &gt;&gt;&gt; getErrStatus)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; (putStrLn . show) status</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
where<br>&nbsp;&nbsp; expandNode :: (ArrowXml a) =&gt; XmlTree -&gt; a XmlTree XmlTree<br>&nbsp;&nbsp; expandNode :: (ArrowXml a) =&gt; XmlTree -&gt; a XmlTree XmlTree</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp; <span style="font-weight: bold;">expandNode foos = this&nbsp;&nbsp;&nbsp; -- what here???</span><br>&nbsp;&nbsp; isFoo = deep (hasName &quot;foo&quot;)<br><br></span>The issue is that in 'expandNode', I have an XmlTree (foos) and an arrow whose input is the node to be replaced (also an XmlTree), but I need a String and an arrow whose input is the XmlTree (foos):
<br><br>expandNode' :: (ArrowXml a) =&gt; String -&gt; a XmlTree XmlTree<br>expandNode' name = processChildren (hasAttrValue &quot;name&quot; name)<br><br>Somewhat related, if the output of an arrow is a string, can I get access to that string without using 'runX':
<br><a href="http://www.fh-wedel.de/%7Esi/HXmlToolbox/hdoc_arrow/Text-XML-HXT-Arrow-XmlArrow.html#v%3AgetAttrValue">getAttrValue</a> :: String -&gt; a <a href="http://www.fh-wedel.de/%7Esi/HXmlToolbox/hdoc_arrow/Text-XML-HXT-DOM-TypeDefs.html#t%3AXmlTree">
XmlTree</a> String<br><br>Are Arrows the wrong tool for this job?<br><br>Thanks,<br>Greg<br><br><span style="font-family: courier new,monospace;"></span><br><br><br>On 7/14/06, Greg Fitzgerald &lt;<a href="mailto:garious@gmail.com">
garious@gmail.com</a>&gt; wrote:<br>&gt; <br>&gt; I'm trying to think of a way to translate this input, to the output below:<br>&gt; <br>&gt; Input:<br>&gt; &lt;test&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo name=&quot;a&quot;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wahoo&gt;A&lt;/wahoo&gt;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/foo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo name=&quot;b&quot;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wahoo&gt;B&lt;/wahoo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/foo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;foo name=&quot;c&quot;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wahoo&gt;C&lt;/wahoo&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/foo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;group&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;bar ref=&quot;b&quot;/&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;bar ref=&quot;a&quot;/&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/group&gt;<br>&gt; &lt;/test&gt;<br>&gt; <br>&gt; Output:<br>&gt; &lt;test&gt;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;group&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wahoo&gt;B&lt;/wahoo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;wahoo&gt;A&lt;/wahoo&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/group&gt;<br>&gt; &lt;/test&gt;<br>&gt; <br>&gt; That is, anywhere there is a 'bar', replace it with the contents of the 'foo' it references.&nbsp;&nbsp;I'm having a difficult time representing this with HXT's Arrow API because the value of the 'ref' attribute is the output of an arrow, but I need it to be just a plain string so that I could use it as an input parameter to the 'hasAttrValue' function.&nbsp;&nbsp;A similar problem, using 'processTopDown', once I traverse to a 'bar' node, I need to then traverse the root again to find the 'foo', but I'm in the context of the 'bar' node, not the root. 
<br>&gt; <br>&gt; My ears are open to solutions with HaXML or Scrap Your XML-plate, or anything else.<br>&gt; <br>&gt; Thanks,<br>&gt; <br>&gt; Greg<br>&gt; <br>&gt;&nbsp;&nbsp; <br><br>