[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Usefull?

Subject: Usefull?
From: Fernando López Carballeda <fernando@xxxxxxxxx>
Date: Tue, 9 Jan 2001 19:12:46 +0100
usefull
Hi,

I think this cuold be usefull for someone else, basicly only add id to every
element from the XML file an unique ID.

<?xml version='1.0' encoding='ISO-8859-1'?>
<xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     version = "1.0">
  <xsl:output method="xml" encoding="ISO-8859-1" indent="yes" />

  <xsl:template match = "*" >
    <xsl:copy >
      <xsl:apply-templates select = "@*" />
      <xsl:attribute
      	   name="id"><xsl:call-template name="object.id"/></xsl:attribute>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>

  <xsl:template match = "@*" >
    <xsl:copy />
  </xsl:template>

  <!--
====================================================================== -->

  <xsl:template name="object.id">
    <xsl:param name="object" select="."/>
    <xsl:choose>
      <xsl:when test="$object/@id">
        <xsl:value-of select="$object/@id"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="generate-id($object)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

Regards,
Fernando López Carballeda

PS.- Do not hesitate to correct me.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Usefull?
    • Fernando López Carballeda - Tue, 9 Jan 2001 13:06:44 -0500 (EST) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.