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 June 18th, 2008, 05:07 PM
Registered User
 
Join Date: Apr 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Special Characters not working for me

I am trying to change one line in my WSDL. I am using ANT and XSLT to accomplish this. I have it all working but the "<" and "/>" is not coming out right.

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:output method="xml" encoding="UTF-8" indent="yes" />

  <xsl:param name="url-address" required="yes" as="xs:string" />


  <xsl:template match="*">

    <xsl:choose>
          <xsl:when test="@location">
               <xsl:comment>
                  <xsl:text>The [server]:[port]/[web context]/is information is assigned via XSLT and Properties file </xsl:text>
               </xsl:comment>
               <xsl:text>
               </xsl:text>
               <xsl:comment>
                  <xsl:text>http://[server +: port]/[web content]/[servlet-mapping pattern]/[service name] </xsl:text>
               </xsl:comment>
               <xsl:text>
               </xsl:text>
                <xsl:text>#60;soap:address location="</xsl:text>
               <xsl:value-of select="$url-address"/>
               <xsl:text>" /></xsl:text>
               <xsl:apply-templates />
          </xsl:when>
          <xsl:otherwise>
             <xsl:copy copy-namespaces="yes">
                 <xsl:copy-of select="@*" />
                     <xsl:apply-templates />
             </xsl:copy>
          </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
My results are:

Code:
 &lt;soap:address location="http://localhost1:8081/my_metadata_db1/search1/MyDocumentRetrievalService1" /&gt;
What am I missing?


Thanks in advance for any suggestions.

Russ

 
Old June 18th, 2008, 05:21 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Always remember that the output of your stylesheet is a tree of nodes, not lexical XML markup. If you want to create an element, you need to create an element node, not an angle-bracket representation of the node. Leave that to the serializer.

In your case this is dead easy: change

<xsl:text>#60;soap:address location="</xsl:text>
               <xsl:value-of select="$url-address"/>
               <xsl:text>" /></xsl:text>

to

<soap:address location="{$url-address}"/>

You'll also need to make sure that the soap namespace prefix is declared somewhere in the stylesheet.



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 vs. special characters brko C# 1 January 23rd, 2006 11:05 AM
storing special special characters in nvarchar... ACE2084 SQL Server 2000 2 February 9th, 2005 11:45 AM
Substring and special characters geordaa XSLT 4 September 24th, 2004 02:27 AM
special characters lian_a Classic ASP Basics 3 June 23rd, 2004 05:16 AM





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