|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Extracting Unique element names and attributes fro
At 06:56 PM 10/28/2008, Mike wrote:
saxon:evaluate seems quite unnecessary here (and will be a lot more expensive than necessary).... Also, Mike earlier suggested using xsl:for-each-group, which offers a nice solution: <xsl:for-each-group select="//*" group-by="name()">
<xsl:text>

</xsl:text><!-- two new lines -->
<xsl:value-of select="current-grouping-key()"/>
<xsl:for-each-group select="current-group()/@*" group-by="name()">
<xsl:text>
 </xsl:text><!-- new line, indent -->
<xsl:value-of select="current-grouping-key()"/>
</xsl:for-each-group>
</xsl:for-each-group>This is somewhat different from what was posted, in that it lists distinct attributes that may appear with each element, but this is usually useful information -- and if you do want a list of attributes appearing absolutely, just do the element thing again, except selecting "//@*". (Also, I haven't taken the trouble to make HTML out of it.) This approach can be taken one more step to report values of attributes, or repeating values of attributes (which sometimes makes for less noise). Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|

Cart








