Jump to content
kareka

position() em XPath

Recommended Posts

kareka

Boas pessoal!

Estou a usar um ficheiro XSLT para fazer transformações de um XML para outro.

Nessa transformação listo Proprietarios, o que eu queria é que me dissesse a posição desse Proprietario. Já tentei utilizar o position() mas mostra-me sempre 1.

Alguém me pode ajudar?


<?php include("assinatura.txt"); ?>

Share this post


Link to post
Share on other sites
Rui Carlos

Algo deste género deve funcionar:

<xsl:variable name="props" select="//Proprietario"/>
<xsl:for-each select="$props">
   <item><xsl:value-of select="position()"/></item>
</xsl:for-each>

Share this post


Link to post
Share on other sites
kareka

Done! Obrigado mais uma vez Rui Carlos  :D


<?php include("assinatura.txt"); ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.