|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: i need a progressive id...
Use the position() function; or for more elaborate numbering, use <xsl:number>. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Gianni G [mailto:giagug80@xxxxxxxxxxx] > Sent: 17 December 2005 17:51 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: i need a progressive id... > > Hi, > i am an italian student. > > I need to do an xsl transformation to trasform an xml file in > an xmi file. > > The xml file has a sintax like this: > > <?xml version="1.0" encoding="ASCII" ?> > - <useCaseUMLDiagramModel:UseCaseDiagram xmi:version="2.0" > xmlns:xmi="http://www.omg.org/XMI" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:useCaseUMLDiagramModel="http://useCaseUMLDiagramModel"> > - <modelElements type="useCaseUMLDiagramModel:Actor" description="" > name="Utente" location="Point(114, 134)" stereotype="Actor"> > <sourceRelationships > xsi:type="useCaseUMLDiagramModel:CommunicateConnection" > target="//@modelElements.1" stereotype="communicate" /> > </modelElements> > <modelElements type="useCaseUMLDiagramModel:UseCase" description="" > name="Autenticazione" > targetRelationships="//@modelElements.0/@sourceRelationships.0" > location="Point(339, 149)" size="Dimension(100, 70)" > stereotype="Use Case" > /> > </useCaseUMLDiagramModel:UseCaseDiagram> > > I need to have an unique id for my xmi file. > > This is a little part of my xsl file... > > [...] > - <xsl:template match="//modelElements"> > - <xsl:choose> > - <xsl:when test="@type='useCaseUMLDiagramModel:Actor'"> > - <Behavioral_Elements.Use_Cases.Actor xmi.id="????"> > <----------- HERE IS > THE PROBLEM > - <Foundation.Core.ModelElement.name> > <xsl:value-of select="@name" /> > </Foundation.Core.ModelElement.name> > <Foundation.Core.ModelElement.isSpecification xmi.value="false" /> > <Foundation.Core.GeneralizableElement.isRoot xmi.value="false" /> > <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false" /> > <Foundation.Core.GeneralizableElement.isAbstract > xmi.value="false" /> > - <Foundation.Core.ModelElement.namespace> > <Foundation.Core.Namespace xmi.idref="D.1" /> > - <!-- Use Case View > --> > </Foundation.Core.ModelElement.namespace> > </Behavioral_Elements.Use_Cases.Actor> > </xsl:when> > - <xsl:when test="@type='useCaseUMLDiagramModel:UseCase'"> > - <Behavioral_Elements.Use_Cases.UseCase xmi.id="???"> > <----------- > HERE IS THE PROBLEM > - <Foundation.Core.ModelElement.name> > <xsl:value-of select="@name" /> > </Foundation.Core.ModelElement.name> > <Foundation.Core.ModelElement.visibility xmi.value="private" /> > <Foundation.Core.GeneralizableElement.isRoot xmi.value="false" /> > <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false" /> > <Foundation.Core.GeneralizableElement.isAbstract > xmi.value="false" /> > - <Foundation.Core.ModelElement.namespace> > <Model_Management.Model xmi.idref="D.1" /> > - <!-- Use Case View > --> > </Foundation.Core.ModelElement.namespace> > </Behavioral_Elements.Use_Cases.UseCase> > </xsl:when> > - <xsl:otherwise> > <errore>errore</errore> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > [...] > > The question is: how can i count the model elements and put > the correct id? > I tryed to use the count function but it gives me the total number of > elements. > I need something like a counter but i have also readed thah i > cant update an > xsl variable. > > Someone can give me an help? It's so important! > > Thanks, and sorry for my bad english. > > Best regards, Gianni.
|
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








