Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2007, 07:23 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default Convert XML to XML template question

Hi,

This post is related to : http://p2p.wrox.com/topic.asp?TOPIC_ID=62762

I am able to convert all my XML to my new schemas with one exception, my <td> for my tables.

The desired transformation would change:

<ACM:td>
     <ACM:Para>some text</ACM:Para>
</ACM:td>


to

<td>
<PARA>some text</PARA>
</td>

howerver I get this result


<td>
<para ACM="somedomain.com">some text</para>
</td>

Here is my XSLT templates:


Code:
    
    <xsl:template match="ACM:Para">
        <xsl:element name="PARA">
            <xsl:choose>
                <xsl:when test="@revision_date">
                    <xsl:attribute name="revdate"><xsl:for-each select="@revision_date"><xsl:value-of select="."/></xsl:for-each></xsl:attribute>
                </xsl:when>
                <xsl:otherwise/>
            </xsl:choose>
            <xsl:choose>
                <xsl:when test="@Revision">
                    <xsl:attribute name="revision"><xsl:for-each select="@Revision"><xsl:value-of select="."/></xsl:for-each></xsl:attribute>
                </xsl:when>
                <xsl:otherwise/>
            </xsl:choose>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>
<xsl:template match="ACM:table">
        <xsl:element name="table">
            <xsl:attribute name="numofcolumns"><xsl:value-of select="@numofcolumns"/></xsl:attribute>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="ACM:tbody">
        <xsl:element name="tbody">
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="ACM:tr">
        <xsl:element name="tr">
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="ACM:td">
        <xsl:element name="td">

                <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>


Thanks for the help.
 
Old July 12th, 2007, 07:30 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There is nothing in this code that can ever generate a <para> element (with the name in lower case) or an ACM attribute, so you're either wrong about the output this generates, or it's being generated by some completely different part of your code.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 12th, 2007, 07:36 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Thank you Michael, This is whats confusing me. Would you like
to see the full XSLT?


 
Old July 12th, 2007, 07:47 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>Would you like to see the full XSLT?

No, I would much rather you debugged it yourself ;)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XML question for you XML Gurus SQLScott SQL Server 2005 1 June 25th, 2008 11:29 AM
Convert 1 big XML to multiple smaller XML victorcorey XSLT 1 March 20th, 2008 05:59 AM
What is XML Template srkumar XML 5 February 7th, 2008 05:06 PM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
import XML Form Into Template drrocket0302 Infopath 0 May 24th, 2007 09:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.