[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL Remove part of a text inside TAG

Subject: XSL Remove part of a text inside TAG
From: buddhi <buddhi@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Mar 2008 10:46:48 +0530
 XSL Remove part of a text inside TAG
Hi,

Now follwoign XSL works for me, but I am loosing children from <visualObjects> tag, I am only getting <fontface> inside... Is there anyway to get other tags (unmodified)

- Buddhi -

My XSL:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/"> <xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="VisualObject">
<xsl:choose>
<xsl:when test="@xsi:type='CBarCode'">
<xsl:copy>
<FontFace>
<xsl:variable name="fontface" select = 'FontFace'/>
<xsl:call-template name="while">
<xsl:with-param name="foo" select="$fontface"/>
</xsl:call-template>
</FontFace>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template name="while">
   <xsl:param name="foo"/>
   <xsl:choose>
       <xsl:when test="contains($foo,'\')">
           <xsl:variable name="newfoo" select="substring-after($foo,'\')"/>
           <xsl:call-template name="while">
               <xsl:with-param name="foo" select="$newfoo"/>
           </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
           <xsl:value-of select="$foo"/>
       </xsl:otherwise>
   </xsl:choose>
</xsl:template>
</xsl:stylesheet>




Hi all,


Following is my xml file,

<?xml version="1.0"?>
<FileSerializeWrapper xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <Unit>Inches</Unit>
 <PanPoint>
   <X>0</X>
   <Y>0</Y>
 </PanPoint>
 <ZoomFactor>0</ZoomFactor>
 <FlowData>
   <VisualObject xsi:type="CProjectEx">
     <maxQSwitch>500</maxQSwitch>
     <Address>Laser Job</Address>
   </VisualObject>
   <TrueSideChildren>
     <FlowData>
       <VisualObject xsi:type="CLayerEx">
         <maxQSwitch>500</maxQSwitch>
         <Address>Laser Job.Layer</Address>
         <Name>Layer</Name>
         <Override>true</Override>
       </VisualObject>
       <FlowType>Layer</FlowType>
       <TrueSideChildren>
         <FlowData>
           <VisualObject xsi:type="CBarCode">
             <maxQSwitch>133</maxQSwitch>
             <Address>Laser Job.Layer.Barcode1</Address>
             <Name>Barcode1</Name>
             <Width>2.8144999999999953</Width>
             <DataString>CODE 39 TEXT</DataString>
             <EncodeData>
               <dBCHeight>0.5</dBCHeight>
               <dBCWidth>2.8144999999999953</dBCWidth>
               <szQRFmtAppIndicator />
             </EncodeData>
             <EnableHRText>true</EnableHRText>
             <FontFace>D:\Work\Phase
III\Executables\Fonts\TIMESNRO.FNT</FontFace>
             <IsBold>false</IsBold>
             <IsItalic>false</IsItalic>
             <FontHeight>0.08</FontHeight>
             <FontGap>0.02</FontGap>
             <HRTextAtTop>false</HRTextAtTop>
           </VisualObject>
           <ShapeName />
         </FlowData>
       </TrueSideChildren>
       <FalseSideChildren />
       <IsExpanded>true</IsExpanded>
       <EventDataCode />
       <ShapeName />
     </FlowData>
   </TrueSideChildren>
   <FalseSideChildren />
   <EventDataCode />
   <ShapeName />
 </FlowData>
</FileSerializeWrapper>

Actually I want ONLY to remove a path from this tag,

<FontFace>D:\Work\Phase III\Executables\Fonts\TIMESNRO.FNT</FontFace>

In final xml file I want to appear it as this,

<FontFace>TIMESNRO.FNT</FontFace>

I tried so many ways, since I couldn't find mid,left, right string functions with xsl, I couldn't get the expected out put. Following is my xsl file. Can anyone please tell me how to do that.

My XSL file :

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/"> <xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="VisualObject">
<xsl:choose>
<xsl:when test="@xsi:type='CBarCode'">
<xsl:copy>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


- Regards

- Buddhi -

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.