What is the XSLT to write certain node attributes one-to-a-line?
- by Scott Stafford
I want an XML stylesheet (XSLT) that will put the attributes of a few, specific, child nodes one-to-a-line. What is the XSLT for this?
I recently asked a related question that someone offered a stylesheet to solve but their stylesheet didn't work for some reason, and I am curious why -- the attributes simply didn't end up one-per-line.
By way of example, my XML might look like this:
<MyXML>
<NodeA>
<ChildNode value1='5' value2='6' />
</NodeA>
<NodeB>
<AnotherChildNode value1='5' value2='6' />
</NodeB>
<NodeC>
<AnotherChildNode value1='5' value2='6' />
</NodeC>
</MyXML>
And I want a stylesheet that will expand all NodeA's and NodeB's but not NodeCs and make it look like this:
<MyXML>
<NodeA>
<ChildNode
value1='5'
value2='6' />
</NodeA>
<NodeB>
<AnotherChildNode
value1='5'
value2='6' />
</NodeB>
<NodeC>
<AnotherChildNode value1='5' value2='6' />
</NodeC>
</MyXML>