You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by "Samson, Lyndon [IT]" <ly...@ssmb.com> on 2001/02/23 12:51:29 UTC

XSLT question

Hi Listers

I have a XSLT template which match="something/*" I want to reference the
name of
the sub element matched in the output.

ie

input

<something>
  <subthing1>aa</subthing1>
  <subthing2>bb</subthing2>
  <subotherthing1>cc</subotherthing1>
</something>

template

<xsl:template match="something/*">
 <xsl:what-do-use-here>=<xsl:value-of select="."/>
</xsl:template>

output

subthing1=aa
subthing2=bb
...

I know this is allmost certainly massivly simple, yet still I can't get it,
I'm just a doofus I guess :-)

thanks

PS. To the pedants, I know this is slighty off topic, sorry...

Re: XSLT question

Posted by Arnaud Vandyck <ar...@ressource-toi.org>.
----- Original Message ----- 
From: "Samson, Lyndon [IT]" <ly...@ssmb.com>
To: <ge...@xml.apache.org>
Sent: Friday, February 23, 2001 12:51 PM
Subject: XSLT question 


> <something>
>   <subthing1>aa</subthing1>
>   <subthing2>bb</subthing2>
>   <subotherthing1>cc</subotherthing1>
> </something>
> 
> template
> 
> <xsl:template match="something/*">
>  <xsl:what-do-use-here>=<xsl:value-of select="."/>
> </xsl:template>
> 
> output
> 
> subthing1=aa
> subthing2=bb
> ...

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

-- Arnaud Vandyck
<http://www.ressource-toi.org>



RE: XSLT question

Posted by Alistair Hopkins <al...@berthengron.co.uk>.
<xsl:template match="something/*">
 <xsl:value-of select="name()"/>=<xsl:value-of select="."/>
</xsl:template>

I believe will do the trick, see also local-name() to lose any namespace you
may use.

Also irrelevant perhaps,

I started writing a java/xsl thing called XSLDoc which aimed to create
javadoc-style documentation for sets of stylesheets that import each other,
etc.  Does anyone know of a mature example of this sort of thing?

Alistair

-----Original Message-----
From: Samson, Lyndon [IT] [mailto:lyndon.samson@ssmb.com]
Sent: Friday, February 23, 2001 11:51 AM
To: 'general@xml.apache.org'
Subject: XSLT question


Hi Listers

I have a XSLT template which match="something/*" I want to reference the
name of
the sub element matched in the output.

ie

input

<something>
  <subthing1>aa</subthing1>
  <subthing2>bb</subthing2>
  <subotherthing1>cc</subotherthing1>
</something>

template

<xsl:template match="something/*">
 <xsl:what-do-use-here>=<xsl:value-of select="."/>
</xsl:template>

output

subthing1=aa
subthing2=bb
...

I know this is allmost certainly massivly simple, yet still I can't get it,
I'm just a doofus I guess :-)

thanks

PS. To the pedants, I know this is slighty off topic, sorry...

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org