Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL for removing words less than 4 letters in a sitemap

From: Olagato <olagato@-----.--->
To: NULL
Date: 4/10/2008 4:48:00 AM
On 9 abr, 15:51, Martin Honnen <mahotr...@yahoo.de> wrote:
> Olagato wrote:
> > So there are 2 things left:
> > 1- <lastmod> tags should dissapear from <url> outputs because a
> > <news:publication_date> tag has been defined already.
> > 2- xmlns:news namespace should dissapear from <news:news> tags and it
> > should be taken to the <urlset xmlns="http://www.sitemaps.org/schemas/
> > sitemap/0.9"> tag in the header.
>
> Both are easy adaptions, you need to use a predicate
> [not(self::sm:lastmod)] and you can use xsl:namespace to make sure a
> namespace declaration is created on the root element:
>
> <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
>    xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9"
>    exclude-result-prefixes="sm"
>    version="2.0">
>         <xsl:output method="xml" indent="yes"/>
>         <xsl:strip-space elements="*"/>
>         <xsl:template match="@* | node()">
>                 <xsl:copy>
>                         <xsl:apply-templates select="@* | node()"/>
>                 </xsl:copy>
>         </xsl:template>
>          <xsl:template match="sm:urlset">
>            <xsl:copy>
>              <xsl:namespace name="news"
> select="'http://www.google.com/schemas/sitemap-news/0.9'"/>
>              <xsl:apply-templates select="@* | node()"/>
>            </xsl:copy>
>          </xsl:template>
>         <xsl:template match="sm:url">
>                 <xsl:copy>
>                         <xsl:apply-templates select="@* | node()[not(self::sm:lastmod)]"/>
>                         <news:news>
>                                 <news:publication_date>
>                                         <xsl:value-of select="sm:lastmod"/>
>                                 </news:publication_date>
>                                 <news:keywords>
>                                         <xsl:value-of select="for $s in tokenize(sm:loc, '/')[position()
> &gt; 5]
>                       return tokenize($s, '[\-/]')[string-length(.)
> &gt; 3]" separator=", "/>
>                                 </news:keywords>
>                         </news:news>
>                 </xsl:copy>
>         </xsl:template>
> </xsl:stylesheet>
> --
>
>         Martin Honnen
>        http://JavaScript.FAQTs.com/


Solved !!! It works fine now.
I have modified line:
      for $s in tokenize(sm:loc, '/')[position()&gt; 5]
to this one:
      for $s in tokenize(sm:loc, '/')[position()&gt; 6]
in order to delete "ezwebin_site" word within <news:keywords> tag.
Thank you very much Martin, people like you make the "world wide web"
to be a better place.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent