This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > February 2005 > how to determine tagname in XLT





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to determine tagname in XLT
Adolf Kanigowski

2005-02-14, 6:36 pm

Hi!
How to get the "tagName" of a XML-Element
using XLT

I try to transform XML to XML.

thanks for helping

Adolf :-)


Martin Honnen

2005-02-14, 6:36 pm



Adolf Kanigowski wrote:


> How to get the "tagName" of a XML-Element
> using XLT


XSLT? XSLT 1.0 uses XPath 1.0 functions like
local-name()
name()
namespace-uri()
Docs are here:
<http://www.w3.org/TR/xpath>
<http://www.w3.org/TR/xpath#section-Node-Set-Functions>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Adolf Kanigowski

2005-02-14, 6:36 pm

Thanks!

Do you know, where I find a samlpe?

Adolf

"Martin Honnen" <mahotrash@yahoo.de> schrieb im Newsbeitrag
news:uQfyJ6rEFHA.1012@TK2MSFTNGP14.phx.gbl...
>
>
> Adolf Kanigowski wrote:
>
>
>
> XSLT? XSLT 1.0 uses XPath 1.0 functions like
> local-name()
> name()
> namespace-uri()
> Docs are here:
> <http://www.w3.org/TR/xpath>
> <http://www.w3.org/TR/xpath#section-Node-Set-Functions>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/



Stanimir Stamenkov

2005-02-14, 6:36 pm

/Adolf Kanigowski/:

> Do you know, where I find a samlpe?


Something like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output mode="text" />

<xsl:template match="*">
<xsl:value-of select="local-name(.)" />
<xsl:apply-templates />
</xsl:template>

</xsl:stylesheet>

or

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" />

<xsl:template match="*">
<xsl:element name="gen-{local-name(.)}">
<xsl:for-each select="@*">
<xsl:attribute name="{local-name(.)}-new">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates />
</xsl:element>
</xsl:template>

<xsl:template match="text()">
<xsl:copy />
</xsl:template>

</xsl:stylesheet>

--
Stanimir
Adolf Kanigowski

2005-02-15, 4:21 am

Thanks
it helps

Adolf Kanigowski


"Stanimir Stamenkov" <stanio@domain.invalid> schrieb im Newsbeitrag
news:Oxgr5ptEFHA.3376@TK2MSFTNGP12.phx.gbl...
> /Adolf Kanigowski/:
>
>
> Something like:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:output mode="text" />
>
> <xsl:template match="*">
> <xsl:value-of select="local-name(.)" />
> <xsl:apply-templates />
> </xsl:template>
>
> </xsl:stylesheet>
>
> or
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:output method="xml" />
>
> <xsl:template match="*">
> <xsl:element name="gen-{local-name(.)}">
> <xsl:for-each select="@*">
> <xsl:attribute name="{local-name(.)}-new">
> <xsl:value-of select="." />
> </xsl:attribute>
> </xsl:for-each>
> <xsl:apply-templates />
> </xsl:element>
> </xsl:template>
>
> <xsl:template match="text()">
> <xsl:copy />
> </xsl:template>
>
> </xsl:stylesheet>
>
> --
> Stanimir



Dimitre Novatchev

2005-02-15, 4:21 am

I always recommend reading a good book on XPath/XSLT if one is really
serious about learning XSLT.


Cheers,
Dimitre Novatchev.
"Adolf Kanigowski" <adolf_kanigowski@hotmail.com> wrote in message
news:u06MTDsEFHA.2876@TK2MSFTNGP12.phx.gbl...
> Thanks!
>
> Do you know, where I find a samlpe?
>
> Adolf
>
> "Martin Honnen" <mahotrash@yahoo.de> schrieb im Newsbeitrag
> news:uQfyJ6rEFHA.1012@TK2MSFTNGP14.phx.gbl...
>
>



Joe Fawcett

2005-02-15, 7:27 am

"Dimitre Novatchev" <dnovatchev@yahoo.com> wrote in message
news:37dn0dF5ba1k3U1@individual.net...
> I always recommend reading a good book on XPath/XSLT if one is really
> serious about learning XSLT.
>
>
> Cheers,
> Dimitre Novatchev.


But does anyone listen ;)


--

Joe (MVP)


Adolf Kanigowski

2005-02-15, 6:43 pm

I'm missing the book tip!

Adolf :-)

"Dimitre Novatchev" <dnovatchev@yahoo.com> schrieb im Newsbeitrag
news:37dn0dF5ba1k3U1@individual.net...
>I always recommend reading a good book on XPath/XSLT if one is really
>serious about learning XSLT.
>
>
> Cheers,
> Dimitre Novatchev.
> "Adolf Kanigowski" <adolf_kanigowski@hotmail.com> wrote in message
> news:u06MTDsEFHA.2876@TK2MSFTNGP12.phx.gbl...
>
>



Dimitre Novatchev

2005-02-15, 6:43 pm


"Adolf Kanigowski" <adolf_kanigowski@hotmail.com> wrote in message
news:OKcayA2EFHA.3928@TK2MSFTNGP15.phx.gbl...
> I'm missing the book tip!
>
> Adolf :-)


1. I personally always go with the classic -- so this is "XSLT Programmer's
Reference" by Michael Kay -- now there's a new book under the same name
covering XSLT 2.0

2. Probably the best book for beginners is Jeni Tennison's "Beginning XSLT".
All her books are masterpieces, so I'll recommend also "XSLT and XPath on
the Edge"

3. For people, who consider themselves experts, a very useful book is Sal
Mangano's "XSLT Cookbook"


Cheers,
Dimitre Novatchev.



>
> "Dimitre Novatchev" <dnovatchev@yahoo.com> schrieb im Newsbeitrag
> news:37dn0dF5ba1k3U1@individual.net...
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews