Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: problem with xslt

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 11/6/2005 11:40:00 PM
paulhux174@h... wrote:

> 
>           <Books>
>              <Book>
>                <Desc>AAA</Desc>
>                <Type>FRZ</Type>
>             </Book>
>             <Book>
>                <Desc>BBB</Desc>
>                <Type>ABC</Type>
>             </Book>
>             <Book>
>                <Desc>DDD</Desc>
>                <Type>DEF</Type>
>             </Book>
>             <Book>
>                <Desc>EEE</Desc>
>                <Type>HIJ</Type>
>             </Book>
>          </Books>
> 
>    <xsl:element name=:value-of select="Type" namespace="">
>       <xsl:attribute name=$attrName>
>         <xsl:value-of select="Desc"/>
>     </xsl:attribute>
>    </xsl:element>
> 
> What I want to achieve is
>    <AAA Desc="FRZ">
>    <BBB Desc="ABC">
>    <DDD Desc="DEF">
>   ....
> Can you see if mt xslt is correct?

I have no idea what your XSLT is trying to do, and your specified output 
is not well-formed XML.

To get the output I think you mean, use:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output method="text"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="Type">
    <xsl:text>&lt;</xsl:text>
    <xsl:value-of select="."/>
    <xsl:text> Desc="</xsl:text>
    <xsl:value-of select="preceding-sibling::Desc"/>
    <xsl:text>"/>&#x000A;</xsl:text>
  </xsl:template>

  <xsl:template match="Desc"/>

</xsl:stylesheet>

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent