Subject: RE: [xsl] mixed content nodes question From: cknell@xxxxxxxxxx Date: Fri, 07 Jan 2005 14:35:02 -0500 |
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:strip-space elements="*" />
<xsl:template match="/"> <xsl:apply-templates /> </xsl:template>
<xsl:template match="root"> <root> <xsl:apply-templates /> </root> </xsl:template>
<xsl:template match="child"> <xsl:apply-templates /> </xsl:template>
<xsl:template match="leaf"> <xsl:variable name="digit"> <xsl:if test="./dictionary"><xsl:value-of select="./dictionary" /></xsl:if> </xsl:variable> <xsl:variable name="frag"> <xsl:choose> <xsl:when test="./dictionary/@lookup='3'">Foo</xsl:when> <xsl:when test="./dictionary/@lookup='4'">Bar</xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> </xsl:variable> <leaf><xsl:value-of select="substring(.,1,string-length(.)-2)" /> <xsl:value-of select="$frag" /> <xsl:value-of select="substring(.,string-length(.)-1,string-length(.))" /></leaf> </xsl:template>
</xsl:stylesheet> -- Charles Knell cknell@xxxxxxxxxx - email
-----Original Message----- From: Jeb Boniakowski <jeb@xxxxxxxxxxx> Sent: Fri, 7 Jan 2005 13:35:38 -0500 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] mixed content nodes question
<root> <child> <leaf>Leaf Value1</leaf> <leaf>Leaf Value2</leaf> </child> <child> <leaf>Leaf Value <dictionary lookup="3"/> 3</leaf> </child> </root>
<root> <child> <leaf>Leaf Value1</leaf> <leaf>Leaf Value2</leaf> </child> <child> <leaf>Leaf Value Foo 3</leaf> </child> </root>
If it's vastly easier to process if instead of having: <dictionary lookup="3"/> -> Foo I have: <dictionary>3</dictionary> -> Foo
Any help or pointers to help would be greatly appreciated, jeb.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] lookup table (was: mixed , Mark Lundquist | Thread | [xsl] Diploma thesis --> XML to PDF, senetex |
RE: [xsl] mixed content nodes quest, Mark Lundquist | Date | Re: [xsl] mixed content nodes quest, António Mota |
Month |