Jump to content

netuh

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by netuh

  1. Thanks,Sorry, i already knew that I would have to create parameters. But i forgot insert in example. :) I was study a Java processor, Xalan. And i discovered the method addParameters(String expression).Thanks for the help again.

  2. Hi,Its me again, :) Someone know how i pass parameters to transformation?for example, the code in Java for transfomation:

    	  transformer = tFactory.newTransformer(		  new StreamSource("foo.xls"));	  transformer.transform(		  new StreamSource("foo.xml"),		  new StreamTarget("moo.xml"));

    and te transformation

    <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:template match="/"><foo>	<xsl:for-each select="/thing">		<xsl:if test="name = 'moo' ">			<moo/>		</xsl:if>  	</xsl:for-each></foo></xsl:template></xsl:stylesheet>

    Well, on the contrary compare if name = 'moo', i need passe to transfomation the name for compare.Thanks again...

  3. Hi,Someone know how break a for-each?example:

    <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:template match="/"><foo>	<xsl:for-each select="/thing">		<xsl:if test="name = 'moo' ">			<moo/>		</xsl:if>   	</xsl:for-each></foo></xsl:template></xsl:stylesheet>

    And when the if be true, the tag <moo/> is placed. But i want that when place the tag <moo/>, the for-each stop. Someone can help me?Thanks.

  4. Thanks!!!!!!!i do a small change in your solution. I do two sequences transformations. The first create all nodes <required-service name="name" time="time"/> in a file auxiliary, and the another transfomation be a copy of this xml and sum all @time of <required-service name="name" time="time"/> to final xml.

    <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:template match="/"><performance-analysis>	<xsl:for-each select="/performance-analysis/functional-component">		<functional-component>			<xsl:attribute name="name">					<xsl:value-of select="@name" />			  </xsl:attribute>			<xsl:attribute name="totaltime-requiredservices">					 <xsl:value-of select="sum(required-services/required-service/@time)" />			  </xsl:attribute>			<required-services>				<xsl:for-each select="required-services/required-service">					<required-service>					<xsl:attribute name="name">							<xsl:value-of select="@name" />					  </xsl:attribute>					<xsl:attribute name="time">							 <xsl:value-of select="@time" />					  </xsl:attribute>					</required-service>				</xsl:for-each>			</required-services>		</functional-component>	</xsl:for-each></performance-analysis></xsl:template></xsl:stylesheet>

    Thanks again!!!

  5. hi,i'm beginner in xslt, :) And the previous example is only to ilustrate the problem.in pseudo-code was be thus: :)

      int total = 0;  foreach A{	 foreach B{		 if (A.name == B.name){			total = total + A.position + B.position			value-of A.position + B.position		 }	 }  }  attribute time = total;

    a example of my output is:

    <performance-analysis>  <functional-component name="Functional Componente P" totaltime-requiredservices="2800">	<required-services>		<required-service name="salvar" time="300"/>		<required-service name="imprimir" time="400"/>		<required-service name="gerarRelatorio" time="200"/>		<required-service name="carregar" time="500"/>		<required-service name="validar" time="100"/>		<required-service name="exportar" time="400"/>		<required-service name="importar" time="600"/>		<required-service name="converter" time="300"/>	</required-services>   </functional-component></performance-analysis>

    where the totaltime-requiredservices is the sum of required-service's time, and i only know this values when i generating the output. :) I hope clarified my situation. :blink:

  6. Hi,This is my transformation...

    <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:template match="/">	   <xsl:apply-templates/> </xsl:template><xsl:template match="/"><foo>   <xsl:attribute name="time">	  <xsl:for-each select="/things">		  <xsl:variable name="var1" select="position()" />		  <xsl:variable name="name" select="myName" />		  <moo>		  <xsl:for-each select="/othersThings">			  <xsl:variable name="var2" select="position()" />			  <xsl:if test="name = $name">				  <xsl:copy-of select="($var1+$var2)" />			  </xsl:if>		   </xsl:for-each>		   </moo>	   </xsl:for-each>   </xsl:attribute>   <xsl:attribute name="totalTime">	   <xsl:copy-of select=?????????? />   </xsl:attribute></foo>

    My problem is, where the interrogations are, must be the sum of all moo's times, but i dont know how accumulate those values, once variables dont be changed... someone can help-me?sorry my poor English. :)

×
×
  • Create New...