mzimmerman Posted February 1, 2007 Share Posted February 1, 2007 I'm thrilled to have found a forum where I can post a question of this nature. Thank You....I've spent days buried in various XSLT reference books, but still am unable to find a way to accomplishwhat I am trying to do. (And its making me feel REAL STUPID)I simply need to take XML which is output from a Database query and reformat for use by a Metric tool.I've been through some of the painful Muenchian method documentation, and am still struggling.I simply need to go from:<ROW> <NAME>ABC</NAME> <NUMBER>123</NUMBER></ROW><ROW> <NAME>XYZ</NAME> <NUMBER>789</NUMBER?</ROW>To:<ROW> <TITLE>ABC</TITLE> <TITLE>XYZ</TITLE></ROW><ROW> <VALUE>123</VALUE> <VALUE>789</VALUE>I believe I will have to use keys, but still continue to get values combined under <Row> parents.Any assistance gratefully accepted.Highest Regards, Link to comment Share on other sites More sharing options...
aalbetski Posted February 2, 2007 Share Posted February 2, 2007 try this. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml"/> <xsl:template match="/"> <ROW> <xsl:for-each select="//NAME"> <TITLE><xsl:value-of select="text()"/></TITLE> </xsl:for-each> </ROW> <ROW> <xsl:for-each select="//NUMBER"> <VALUE><xsl:value-of select="text()"/></VALUE> </xsl:for-each> </ROW> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
mzimmerman Posted February 5, 2007 Author Share Posted February 5, 2007 Wait?...No keying needed? no grouping methods...Oh MAN I made this so much harder than it needed to be.Thank you very much...(</grumble>Cobol was easier than this...<grumble>) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now