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 August 20th, 2006, 10:15 PM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL namespace-alias problem

i have the following xsl commands:

<xsl:variable name="field" select="."/>
<output:sort select="($field)" data-type="number"/>

so what i'm trying to do is to output another XSL command through the use of a namespace-alias. but my problem is that, i wanted the select="($field)" part to be dynamic and not to output it literally. is this possible??

thanks.




 
Old August 21st, 2006, 02:18 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Perhaps you want select="{$field}".

But you haven't made yourself clear, what exactly do you want the output to be?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 21st, 2006, 08:36 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the reply. that just solved my problem.

i didn't know about the curly braces, so thanks for the info.

 
Old August 22nd, 2006, 03:08 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

just a follow-up question,

why is it that when i use namespace-alias, it doesn't output the correct namespace specified.

example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http...Transform"
   xmlns:abc="abc">
<xsl:namespace-alias stylesheet-prefix="sgn" result-prefix="xsl"/>
<xsl:template match="/">
   <abc:stylesheet version="1.0">
      <abc:template match="/">
   </abc:stylesheet>
</xsl:template>
</xsl:stylesheet>

of course i'm expecting that the output xsl would have a namespace of "xsl", but instead it totally changes all namespaces to "abc" like these:

<abc:stylesheet version="1.0" xmlns:xsl="http...Transform">
   <abc:template match="/">
</abc:stylesheet>

btw, i'm using the java Transformer class.
what went wrong?

thanks.

 
Old August 22nd, 2006, 03:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If your output is really as specified then it's wrong: the "abc" prefix shouldn't appear unless there is an xmlns:abc="..." namespace declaration. If the "abc" prefix is bound to the XSLT namespace URI, then all is well (prefixes aren't important, only URIs).

Transformer isn't a class, it's an interface. There are several products that implement this interface. What's significant is the implementation you are using. You can discover this by using <xsl:value-of select="system-property('xsl:vendor-url')"/>

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
Namespace problem adwaitjoshi ASP.NET 2.0 Professional 0 March 28th, 2007 10:04 PM
Namespace in XML preventing XSL for-each geordaa XSLT 1 February 5th, 2007 06:14 AM
xsl namespace vidhya XSLT 3 June 29th, 2005 10:09 AM
Problem with Namespace allenracho BOOK: ASP.NET Website Programming Problem-Design-Solution 2 October 22nd, 2003 11:31 AM
The Alias Problem byterbit SQL Language 3 July 3rd, 2003 07:28 PM





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