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 March 12th, 2008, 09:14 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for the response. I have made changes to my xsl and now it is as follows:
<?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"/>
  <xsl:template match="Response">
    <Response>
      <xsl:apply-templates select="address"/>
    </Response>
  </xsl:template>
  <xsl:template match="address">
    <address sequenceNbr="{position()}">
    <xsl:apply-templates/>
    </address>
  </xsl:template>
</xsl:stylesheet>

The input xml is:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="address-position.xsl" type="text/xsl"?>
<Response>
 <address>1237896</address>
 <address>342500</address>
</Response>

The output i am getting is :
1237896
342500

This is just the content in the input xml. The xml tags that i have created through xsl are not coming here. I have checked this using XMLSpy tool. I am using <xsl:output type="xml"/>. So why the tag names are not coming here?

 
Old March 12th, 2008, 09:19 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

When I use your stylesheet and XML input with Saxon 6.5 from the command line then the result is as follows:
Code:
<Response>
   <address sequenceNbr="1">1237896</address>
   <address sequenceNbr="2">342500</address>
</Response>
So that stylesheet is working fine I think. I don't use XML Spy so I can't help with that tool.

 
Old March 12th, 2008, 09:23 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Another reason not to use IE is that if you do View->Source you only see the original XML file, and not the transformed XML file.

Like we said, there is nothing wrong with your XSLT, just the tools you are using to view the result.

/- Sam Judson : Wrox Technical Editor -/
 
Old March 12th, 2008, 09:52 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There's nothing wrong with your stylesheet. There must be something wrong with either (a) the way you are running it, or (b) the way you are viewing the output.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 12th, 2008, 10:33 PM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot to all of you for your responses.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Incrementing the variable value Swetha XSLT 2 April 28th, 2008 04:43 PM
Incrementing member variable in Synchronized block vikkiefd Pro Java 0 March 24th, 2008 04:15 AM
XSL Loop and incrementing a variable 2007-03-29 XSLT 8 March 30th, 2007 10:41 AM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
incrementing value of a variable akibaMaila VB.NET 2002/2003 Basics 4 July 5th, 2005 12:04 PM





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