Hi All,

We are trying to import some xml data into the database. My idea was to make
an xslt and then transform the xml to php code which generates the queries
necessary and then gets evaled as php code for the actual import...

Anyway, i got it working (mostly)!

But i need to get the current element name with x-path. So i have the
following:

<rootEl>
  <elementA><childOfA>some data 1</childOfA></elementA>
  <elementB><childOfB>some data 2</childOfB></elementB>
  <elementB><childOfB>some data 3</childOfB></elementB>
  <elementA><childOfA>some data 4</childOfA></elementA>
  <elementA><childOfA>some data 5</childOfA></elementA>
</rootEl>

<xsl:for-each select="//elementA | //elementB">
  // <xsl:value-of select="childOfA" /> WORKS and gives the value of
childOfA (e.g. some data 1)
  //... the php code...
</xsl:for-each>

In the php code, I need to get the element tag name of the current element,
so either elementA or elementB. How can i get that in an x-path expression?

I know, this is not strictly a php question, but since the project is in php
and this list has a very good response rate, i decided to ask here. I
already looked on the web for hours, but maybe i just don't have the right
keywords.

Please help. Thanks.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
P. J. O'Rourke  - "Everybody knows how to raise children, except the people
who have them."

Reply via email to