Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: transposing to columns [Thread Next] Re: transposing to columnsTo: NULL Date: 1/4/2006 12:13:00 PM Thanks, thanks, and thanks! I just know I'll have time to plow through a good XSLT reference this weekend... "Joe Fawcett" <joefawcett@n...> wrote in message news:OtZNYuUEGHA.3868@T...... > "billdebug" <william.delaney@d...> wrote in message > news:%23MIL9dUEGHA.1584@T...... >> Joe, >> thanks, the <th> tag solves part of my problem. I should have been more >> clear. >> I want to dynamically pick up the row header by reading the xml element >> name. I tried using an xsl:element structure in my xslt but that did not >> work. >> So, what would I put between the <th> to read the element name? >> I can of course use the hardcoded values as you showed me below. That >> works, but I would prefer to read the xml element in case there are >> changes, or if I add more fields. Come to think of it, I have not even >> thought of looping through my elements fields till now. >> >> anyway, thanks for this quick answer. >> >> "Joe Fawcett" <joefawcett@n...> wrote in message >> news:%23TzTbeREGHA.344@T...... >>> "billdebug" <william.delaney@d...> wrote in message >>> news:eYSp43KEGHA.2648@T...... >>>>I have some xml data in the form: >>>> >>>> <event> >>>> <Location>Amsterdam</Location> >>>> <RequestType>Blue</RequestType> >>>> <Severity>Critical</Severity> >>>> </event> >>>> >>>> I can use xslt to produce table with elements in event node horizontal, >>>> but what I want to achieve is: >>>> >>>> Location: Amsterdam >>>> RequestType: Blue >>>> Severity: Critical >>>> >>>> to display in the html table. Having trouble understanding how to >>>> tranpose the elements to this columnar arrangment. >>>> >>> >>> Not sure if my newsreader has interpreted this correctly but, assuming >>> you have your <table>e lement something like: >>> >>> <xsl:template match="event"> >>> <tr><th>Location:</th><td><xsl:value-of select="Location" /></td></tr> >>> <tr><th>RequestType:</th><td><xsl:value-of select="RequestType" >>> /></td></tr> >>> <tr><th>Severity:</th><td><xsl:value-of select="Severity" /></td></tr> >>> </xsl:template> >>> >>> >>> -- >>> >>> Joe Fawcett (MVP - XML) >>> >>> https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 >>> >> >> > > <xsl:template match="event"> > <xsl:for-each select="*"> > <tr><th><xsl:value-of select="local-name()" /></th><td><xsl:value-of > select="." /></td></tr> > </xsl:for-each> > </xsl:template> > > -- > > Joe Fawcett (MVP - XML) > > https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 > > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
