+ Post New Thread
Results 1 to 4 of 4
Web Development Thread, My Question is how do I change ' to ' via the xsl? in Coding and Web Development; ...
  1. #1

    Join Date
    Jun 2007
    Location
    Middlesbrough
    Posts
    143
    Thank Post
    17
    Thanked 10 Times in 10 Posts
    Rep Power
    17

    My Question is how do I change ' to ' via the xsl?

    My Question is how do I change ' to ' via the xsl?

    In ie i get Community Nurse — Children and Young People's Directorate

    In opera i get Community Nurse — Children and Young People's Directorate

    ----------------------------------------------------------------------------------------------------

    Hi I have the following XML


    XML Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE nhs_search [
    <!ELEMENT nhs_search (status, vacancy_details*) >

    <!ELEMENT status (number_of_jobs_found, message*)>
    <!ELEMENT number_of_jobs_found (#PCDATA)>
    <!ELEMENT message (#PCDATA)>

    <!ELEMENT vacancy_details (id, job_reference, job_title, job_description, job_specialty?, job_salary, job_location, job_closedate, job_postdate, job_url)>
    <!ELEMENT id (#PCDATA)>
    <!ELEMENT job_reference (#PCDATA)>
    <!ELEMENT job_title (#PCDATA)>
    <!ELEMENT job_description (#PCDATA)>
    <!ELEMENT job_specialty (#PCDATA)>
    <!ELEMENT job_salary (#PCDATA)>
    <!ELEMENT job_location (#PCDATA)>
    <!ELEMENT job_closedate (#PCDATA)>
    <!ELEMENT job_postdate (#PCDATA)>
    <!ELEMENT job_url (#PCDATA)>
    ]>

    <nhs_search>

    <status>
    <number_of_jobs_found>20</number_of_jobs_found>
    <message></message>
    </status>

    <vacancy_details>
    <id>912080005</id>
    <job_reference>346-CYP-01</job_reference>
    <job_title>Community Nurse</job_title>
    <job_description>An opportunity has arisen within the service for an additional Community Nurse. The Children and Young People’s Service provides a specialist mental health, community based approach to young people, 0-17th year. The service operates as a multi-disciplinary team; nursing psychology and psychiatry, who work together to provide an effective service. The Community Nursing Service works within a multi-agency framework and...</job_description>
    <job_specialty>Children and Young People&amp;apos;s Directorate</job_specialty>
    <job_salary>&amp;#16324,103 - &amp;#16332,653 pr pa</job_salary>
    <job_location>County Durham</job_location>
    <job_closedate>05/09/2008</job_closedate>
    <job_postdate>22/08/2008</job_postdate>
    <job_url>http://www.jobs.nhs.uk/cgi-bin/vacdetails.cgi?selection=912080005</job_url>
    </vacancy_details>

    </nhs_search>

    which gets transformed by the following XSL


    XML Code:

    <!-- DWXMLSource="http://www.jobs.nhs.uk/extsearch?client_id=122252&internal_only=n&infonly =1" -->
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "*">
    <!ENTITY copy "©">
    <!ENTITY reg "®">
    <!ENTITY trade "™">
    <!ENTITY mdash "—">
    <!ENTITY ldquo "“">
    <!ENTITY rdquo "”">
    <!ENTITY pound "£">
    <!ENTITY yen "¥">
    <!ENTITY euro "€">
    <!ENTITY apos "'">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wpc="com.sap.nw.wpc.km.service.linkmanager.X sltHelper">

    <xslutput method="html"/>

    <xsl:template match="/">
    <xsl:for-each select="nhs_search/vacancy_details">

    <xsl:variable name="apos"><xsl:text
    disable-output-escaping="yes">&apos;</xsl:text></xsl:variable>

    <p><xsl:value-of select="job_title" disable-output-escaping="yes"/> — <xsl:value-of select="job_specialty" disable-output-escaping="yes"/></p>

    <p><xsl:value-of select="job_postdate" disable-output-escaping="yes"/> / <xsl:value-of select="job_closedate" disable-output-escaping="yes"/></p>
    <p><xsl:value-of select="job_reference" disable-output-escaping="yes"/> </p>
    <p><xsl:value-of select="job_salary" disable-output-escaping="yes"/></p>
    <p><xsl:value-of select="job_description"/></p>
    <p><xsl:value-of select="job_url" disable-output-escaping="yes"/></p>
    <hr />
    </xsl:for-each>

    </xsl:template>
    </xsl:stylesheet>
    Resulting in


    HTML Code:
    Community Nurse — Children and Young People&apos;s Directorate

    22/08/2008 / 05/09/2008

    346-CYP-01

    £24,103 - £32,653 pr pa

    An opportunity has arisen within the service for an additional Community Nurse. The Children and Young People’s Service provides a specialist mental health, community based approach to young people, 0-17th year. The service operates as a multi-disciplinary team; nursing psychology and psychiatry, who work together to provide an effective service. The Community Nursing Service works within a multi-agency framework and...

    Error Page Question is how do I change &apos; to ' via the xsl?

    I have googled and googled and googled this to no avail any help and assistance will be greatfully recieved.

    The XML cannot be modyfied and comes from

    http://www.jobs.nhs.uk/extsearch?cli...ly=n&infonly=1

    Thank you in advance

    Regards

    Damien

  2. #2
    DT2
    DT2 is offline
    DT2's Avatar
    Join Date
    May 2011
    Location
    Lakeville, Carleton County, New Brunswick
    Posts
    695
    Thank Post
    140
    Thanked 197 Times in 138 Posts
    Rep Power
    75
    try this:

    Code:
    <xsl:template name="escape-apos">
     <xsl:param name="string"/>
    <xsl:variable name="apos" select='"&apos;"' />
    <xsl:choose>
     <xsl:when test='contains($string, $apos)'>
      <xsl:value-of select="substring-before($string,$apos)" />
    	<xsl:text>\'</xsl:text>
    	<xsl:call-template name="escape-apos">
    	 <xsl:with-param name="string"
              select="substring-after($string, $apos)" />
    	</xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="$string" />
     </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    = : & o
    = : & p (without spaces)...
    Last edited by plexer; 20th July 2011 at 05:14 PM.

  3. #3

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,689
    Thank Post
    756
    Thanked 1,715 Times in 1,526 Posts
    Rep Power
    438
    Use the code tags they are available in the advanced editor.

    Ben

  4. Thanks to plexer from:

    DT2 (20th July 2011)

  5. #4
    DT2
    DT2 is offline
    DT2's Avatar
    Join Date
    May 2011
    Location
    Lakeville, Carleton County, New Brunswick
    Posts
    695
    Thank Post
    140
    Thanked 197 Times in 138 Posts
    Rep Power
    75
    couldn't see the wood for the trees.



SHARE:
+ Post New Thread

Similar Threads

  1. SharePoint workflows & question
    By GREED in forum Windows
    Replies: 6
    Last Post: 2nd November 2010, 09:58 AM
  2. Replies: 0
    Last Post: 19th August 2010, 10:52 AM
  3. Replies: 2
    Last Post: 5th July 2010, 11:01 AM
  4. Exchange 2003 - Domain change question
    By Mike-CTS in forum Windows Server 2000/2003
    Replies: 0
    Last Post: 8th April 2010, 12:39 PM
  5. SAS & Sata Question
    By FN-GM in forum Hardware
    Replies: 9
    Last Post: 12th May 2009, 09:05 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •