[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Idea - std. non-flat <g><e/></g> syntax
Placing the ename on each <e> works as expected. But I cannot seem find a good place to add a namespace assignment. I have stuck xmlns:NS1="http://myns/NS1" various places but always get an error. How can we get this revised example to work? <g grpname="NS1:CurrentAssets" grpsign="debit" month="JUN" year="2004" type="actual" division="ABC"> <gx sign="debit"> <e ename="NS1:Cash" etext="500.00"/> <e ename="NS1:MarketableSecurities" etext="250.00"/> <e ename="NS1:TradeReceivables" etext="750.00"/> <e ename="NS1:OtherReceivables" etext="175.00"/> <e ename="NS1:Inventory" etext="110.00"/> <e ename="NS1:PrepaidExpenses" etext="340.00"/> </gx> <gx sign="credit"> <e ename="NS1:ReserveForBadDebts" etext="60.00"></e> </gx> <gi grpsum="2065.00"/> </g> regards, bill p David Carlisle wrote: > > That sounds promising. The whole idea is that attribute heavy flat xml has an > > obvious normalization that I want to accomplish using the <g><e/></g> reformatting > > ... by the simplest most obvious means possible. > > For example, the following is a complete xslt stylesheet that will > convert your <g><e>... input documemt to a series of record elements > with all attributes copied. > > <records xsl:version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:for-each select="//e"> > <xsl:element name="{ancestor-or-self::*[@ename][1]/@ename}"> > <xsl:copy-of > select="ancestor-or-self::*/@*[not(name()='ename')] | > ancestor::*/gi/@*"/> > </xsl:element> > </xsl:for-each> > </records> > > Going in the reverse direction isn't a lot more complicated. > > David > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://www.oasis-open.org/mlmanage/index.php>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|