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 April 4th, 2007, 01:20 PM
Authorized User
 
Join Date: Apr 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<xsl:template match="*"> -- * means for all the elements
  <xsl:element name="{local-name()}" namespace="preferred-uri"> -- means element name is always local-name
    <xsl:copy-of select="@*"/> -- means what ?
    <xsl:apply-templates/> -- means what ?
  </xsl:element>
</xsl:template>


A. Sasi
 
Old April 4th, 2007, 01:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you're worried about performance, switch to Saxon ;)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 9th, 2007, 07:53 AM
Authorized User
 
Join Date: Apr 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael,
Thanks for your solution . i still have one small doubt and i need your help .

i have a source xml without any namespace bindings and prefixes. i have a xsl stylesheet to transform this source xml .

i am directly transforming it . for 10000 requests its taking some 548 sec's to transform all the 10000 .

Now i modified the same source xml . Now the source xml contains namespace bindings . Now my stylesheet will not work .
So i changed my java code so that it will take the source xml first and then apply the stylesheet given by you earlier .Now this removed all the namespace bindings & prefixes.Now i applied my original stylesheet. for 10000 requests its taking nearly 553 sec's now .

but what i thought was it will take more time in the second approach than in first bcoz we are doing one more additional step here for removal of namespace. But the results are not like that .

i dont know why both have taken same time . can you please tell me the reason if you know ? Any way i am using xalan to transform the xml.

Thanks.

A. Sasi
 
Old April 9th, 2007, 08:27 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, but (a) I know very little about Xalan performance, and (b) there's far too little information here to go on. Understanding performance differences between two different applications/programs is something that usually requires very detailed study, it can often depend on factors that you didn't imagine would be significant. So one simply can't answer you question from the information given.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 9th, 2007, 09:42 AM
Authorized User
 
Join Date: Apr 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael,

Ok Yaar , But any clue if i am doing one more step extra to convert the xml also its taking the same time . i also tried very hard to find out the reason .

Thanks & Regards,


A. Sasi
 
Old May 14th, 2007, 04:20 AM
Authorized User
 
Join Date: Apr 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael,

The Xsl you have given only converting the elements .

That is i am applying the xsl on top of a xml which contains prefixes .

This xsl is converting only the elements into other namespace .
I have attributes also with namespaces . In that case it is failing.

How to convert the attributes also into another namespace-uri or null namespace.

Thanks & Regards,
SASI.A


A. Sasi
 
Old May 14th, 2007, 05:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Replace

<xsl:copy-of select="@*"/>

by

<xsl:apply-templates select="@*"/>

and then use a similar technique to change the namespace of your attributes:

<xsl:template match="@*">
<xsl:attribute name="{local-name()}" namespace="????">
  <xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 14th, 2007, 06:12 AM
Authorized User
 
Join Date: Apr 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michale,

The solution in some what confusing . Can you please paste the entire xsl .?

Thanks & Regards,
SAsi.A

A. Sasi
 
Old May 14th, 2007, 06:46 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please see the other thread on which you have raised this.

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
xsl:exclude-result-prefixes #all and #default maxtoroq BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 4 July 28th, 2008 12:10 PM
Help : combobox in xsl to select value by default priyatowin XSLT 8 July 3rd, 2008 09:05 AM
Browser transform using local XSL and remote XML sosarder XSLT 1 March 13th, 2007 02:58 PM
taking particular data .. anukagni Access 2 August 4th, 2006 12:05 AM
Taking information from a cookie snowy0 HTML Code Clinic 1 May 18th, 2004 07:46 PM





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