Search Results

Search found 837 results on 34 pages for 'xsl'.

Page 4/34 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Iteration, or copying in XSL, based on a count. How do I do it?

    - by LOlliffe
    I'm trying to create an inventory list (tab-delimited text, for the output) from XML data. The catch is, I need to take the line that I created, and list it multiple times (iterate ???), based on a number found in the XML. So, from the XML below: <?xml version="1.0" encoding="UTF-8"?> <library> <aisle label="AA"> <row>bb</row> <shelf>a</shelf> <books>4</books> </aisle> <aisle label="BB"> <row>cc</row> <shelf>d</shelf> <books>3</books> </aisle> </library> I need to take the value found in "books", and then copy the text line that number of times. The result looking like this: Aisle Row Shelf Titles AA bb a AA bb a AA bb a AA bb a BB cc d BB cc d BB cc d So that the inventory taker, can then write in the titles found on each shelf. I have the basic structure of my XSL, but I'm not sure how to do the "iteration" portion. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="2.0"> <xsl:output omit-xml-declaration="yes"/> <xsl:variable name="tab" select="'&#09;'"/> <xsl:variable name="newline" select="'&#10;'"/> <xsl:template match="/"> <!-- Start Spreadsheet header --> <xsl:text>Aisle</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Row</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Shelf</xsl:text> <xsl:value-of select="$tab"/> <xsl:text>Titles</xsl:text> <xsl:value-of select="$newline"/> <!-- End spreadsheet header --> <!-- Start entering values from XML --> <xsl:for-each select="library/aisle"> <xsl:value-of select="@label"/> <xsl:value-of select="$tab"/> <xsl:value-of select="row"/> <xsl:value-of select="$tab"/> <xsl:value-of select="shelf"/> <xsl:value-of select="$tab"/> <xsl:value-of select="$tab"/> <xsl:value-of select="$newline"/> </xsl:for-each> <!-- End of values from XML --> <!-- Iteration of the above needed, based on count value in "books" --> </xsl:template> </xsl:stylesheet> Any help would be greatly appreciated. For starters, is "iteration" the right term to be using for this? Thanks!

    Read the article

  • Adding relative path for an external graphic in a XSL document?

    - by Pran
    Hi, first of, I don't know much about XSL. I am using a app called DITA to generate pdfs. One of the things it requires is an overwrite of an xsl file; to add custom styling. I am trying to add an external graphic using a relative path. It doesn't work, unless I supply the full path. Does not work: <fo:block text-align="center" width="100%"> <fo:external-graphic src="../../images/logo.png"/> </fo:block> Does work: <fo:block text-align="center" width="100%"> <fo:external-graphic src="/absolute/path/to/images/logo.png"/> </fo:block> I looked on the web, it said to use "file:image.png" and other website said to use "url(image.png)", but neither worked. What am I doing wrong?

    Read the article

  • Embedding XSL Stylesheet into XML

    - by user700996
    I have the following XML: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="http://www.fakedomain.com/sally.xsl"?> And the following content in sally.xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:for-each select="documentcollection/document"> <p> <xsl:for-each select="rss/channel/item"> <xsl:value-of select="title"/><br /> <xsl:value-of select="description"/><br /> <xsl:value-of select="link"/><br /> </xsl:for-each> </p> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> However, the browser displays the XML as though the XSL line is not present. Do you know why the browser is ignoring the XSL stylesheet? Is the style sheet wrong? Thanks

    Read the article

  • How to get position of parent element - XSL

    - by joe
    What I wish I could do in xsl is the following, but unfortunatly parent/position() is not valid. XSL <xsl:template match="li"> <bullet> <xsl:apply-templates/> </bullet> <!-- todo: if this is the last bullet AND there are no more "p" tags, output footer --> <xsl:if test="count(ancestor::div/*) = parent/position()"> <footer/> </xsl:if> </xsl:template> XML <html> <div> <p>There is an x number of me</p> <p>There is an x number of me</p> <p>There is an x number of me</p> <ul> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> </ul> </div> </html> Anyone have any ideas how to figure out this problem from WITHIN my template match for li? Thanks!

    Read the article

  • Setting xsl:value-of into an href attribute and the text field of a link in an XSLT

    - by Josh
    I am trying to set an a href that is both a link to and has the text for a link through an XSLT transformation. Here's what it looks like so far. <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="actionUrl"/> </xsl:attribute> <xsl:text><xsl:value-of select="actionUrl"/></xsl:text> </xsl:element> The problem is that it says "xsl:value-of cannot be a child of the xsl:text element". Any ideas?

    Read the article

  • Basic question in XSL regarding preceding text

    - by Rachel
    I am new to XSL and i have a basic question on the context of using preceding text. My template match is on the text node. I am iterating over an xml file and within my for loop i am trying to take the preceding text of the text node. Unfortunately preceding::text() is not working if i use it within a for loop. I want to use it within the for loop but how can do it? <xsl:template match="text()"> <xsl:variable name="this" as="text()" select="."/> <xsl:for-each select="$input[@id = generate-id(current())]"> <xsl:variable name="preText" as="xsd:integer" select="sum(preceding::text()[. >> //*[@id=@name]]/string-length(.))"/> ... ... </xsl:for-each> </xsl:template>

    Read the article

  • What is the difference between as="element()+" and as="element()*" in XSL?

    - by Rachel
    What is the difference between using as="element(data)+" and as="element(data)" in xsl:variable. The below XSL solution works if use "+" but not when i use "". Can some one clarify. XSL code: <xsl:variable name="insert-data" as="element(data)+"> <xsl:for-each select="$insert-file/insert-data/data"> <xsl:sort select="xsd:integer(@index)"/> <xsl:variable name="index" select="xsd:integer(@index)" /> <xsl:variable name="nodeName" select="@nodeName" /> <data nodeName="{$nodeName}" index="{@index}" text-id="{$main-root/*//*[@id=$nodeName]/text()[sum((preceding::text(), .)/string-length(.)) ge $index]/generate-id(.)}"> <xsl:copy-of select="node()"/> </data> </xsl:for-each>

    Read the article

  • Why does Saxon evaluate the result-document URI to be the same?

    - by Jan
    My XSL source document looks like this <Topology> <Environment> <Id>test</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> </Machines> </Environment> <Environment> <Id>production</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> <Machine> <Id>machine2</Id> <modules> <module>m3</module> <module>m4</module> </modules> </Machine> </Machines> </Environment> </Topology> I want to create one result-document per machine, so I use the following stylesheet giving modelDir as path for the result-documents as parameter. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" name="myXML" doctype-system="http://java.sun.com/dtd/properties.dtd"/> <xsl:template match="/"> <xsl:for-each-group select="/Topology/Environment/Machines/Machine" group-by="Id"> <xsl:variable name="machine" select="Id"/> <xsl:variable name="filename" select="concat($modelDir,$machine,'.xml')" /> <xsl:message terminate="no">Writing machine description to <xsl:value-of select="$filename"/></xsl:message> <xsl:result-document href="$filename" format="myXML"> <xsl:variable name="currentMachine" select="Id"/> <xsl:for-each select="current-group()/LogicalHosts/LogicalHost"> <xsl:variable name="environment" select="normalize-space(../../../../Id)"/> <xsl:message terminate="no">Module <xsl:value-of select="."/> for <xsl:value-of select="$environment"/></xsl:message> </xsl:for-each> </xsl:result-document> </xsl:for-each-group> </xsl:template> As my messages show me this seems to work fine - if saxon would not evaluate the URI of the result-document to be the same and thus give the following output. Writing machine description to target/build/model/m1.xml Module m1 for test Module m2 for test Module m1 for production Module m2 for production Writing machine description to target/build/model/m2.xml Error at xsl:result-document on line 29 of file:/C:/Projekte/.../machine.xsl: XTDE1490: Cannot write more than one result document to the same URI, or write to a URI that has been read: file:/C:/Projekte/.../$filename file:/C:/Projekte/.../machine.xsl(29,-1) : here Cannot write more than one result document to the same URI, or write to a URI that has been read: file:/C:/Projekte/.../$filename ; SystemID: file:/C:/Projekte/.../machine.xsl; Line#: 29; Column#: -1 net.sf.saxon.trans.DynamicError: Cannot write more than one result document to the same URI, or write to a URI that has been read: file:/C:/Projekte/.../$filename at net.sf.saxon.instruct.ResultDocument.processLeavingTail(ResultDocument.java:300) at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365) at net.sf.saxon.instruct.Instruction.process(Instruction.java:91) Any ideas on how to solve this?

    Read the article

  • DOCTYPE declaration getting lost when using XSL

    - by Rachel
    The input to my XSL is an XHTML. After applying the XSL the DOCTYPE declaration that was present in the input XHTML gets lost in the output. Do i have an option to copy/retain the DOCTYPE declaration in the output using XSL. The XSL processor that i am using is SAXON.

    Read the article

  • XSL match some but not all

    - by Willb
    I have a solution from an earlier post that was kindly provided by Dimitre Novatchev. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="my:my"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> <xsl:key name="kPhysByName" match="KB_XMod_Modules" use="Physician"/> <xsl:template match="/"> <result> <xsl:apply-templates/> </result> </xsl:template> <xsl:template match="/*/*/*[starts-with(name(), 'InfBy')]"> <xsl:variable name="vCur" select="."/> <xsl:for-each select="document('doc2.xml')"> <xsl:variable name="vMod" select="key('kPhysByName', $vCur)"/> <xsl:copy> <items> <item> <label> <xsl:value-of select="$vMod/Physician"/> </label> <value> <xsl:value-of select="$vMod/XModID"/> </value> </item> </items> </xsl:copy> </xsl:for-each> </xsl:template> </xsl:stylesheet> I now need to use additional fields in my source XML and need the existing labels intact but I'm having problems getting this going. <instance> <NewTag>Hello</newTag1> <AnotherNewTag>Everyone</AnotherNewTag> <InfBy1>Dr Phibes</InfBy1> <InfBy2>Dr X</InfBy2> <InfBy3>Dr Chivago</InfBy3> </instance> It drops the additional labels and outputs <result xmlns:my="my:my"> HelloEveryone <items> <item> <label>Dr Phibes</label> <value>60</value> </item> </items> ... I've been experimenting a lot with <xsl:otherwise> <xsl:copy-of select="."> </xsl:copy-of> </xsl:otherwise> but being an xsl newbie I can't seem to get this to work. I've a feeling I'm barking up the wrong tree! Does anyone have any ideas? Thanks, Will

    Read the article

  • I would like to filter XSL output based on a Radio button selection

    - by Phil Speth
    Here is my example I am trying to filter by year based on user selection: I assume some js or jQuery code would be needed: XML file: <?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd> <title>Empire Burlesque3</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <title>Still got the blues</title> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>One night only</title> <artist>Bee Gees</artist> <country>UK</country> <company>Polydor</company> <price>10.90</price> <year>1998</year> </cd> <cd> <title>Sylvias Mother</title> <artist>Dr.Hook</artist> <country>UK</country> <company>CBS</company> <price>8.10</price> <year>1973</year> </cd> <cd> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price> <year>1990</year> </cd> <cd> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company> <price>10.80</price> <year>1996</year> </cd> <cd> <title>When a man loves a woman</title> <artist>Percy Sledge</artist> <country>USA</country> <company>Atlantic</company> <price>8.70</price> <year>1987</year> </cd> <cd> <title>Black angel</title> <artist>Savage Rose</artist> <country>EU</country> <company>Mega</company> <price>10.90</price> <year>1995</year> </cd> <cd> <title>1999 Grammy Nominees</title> <artist>Many</artist> <country>USA</country> <company>Grammy</company> <price>10.20</price> <year>1999</year> </cd> <cd> <title>For the good times</title> <artist>Kenny Rogers</artist> <country>UK</country> <company>Mucik Master</company> <price>8.70</price> <year>1995</year> </cd> <cd> <title>Big Willie style</title> <artist>Will Smith</artist> <country>USA</country> <company>Columbia</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>Tupelo Honey</title> <artist>Van Morrison</artist> <country>UK</country> <company>Polydor</company> <price>8.20</price> <year>1971</year> </cd> <cd> <title>Soulsville</title> <artist>Jorn Hoel</artist> <country>Norway</country> <company>WEA</company> <price>7.90</price> <year>1996</year> </cd> <cd> <title>The very best of</title> <artist>Cat Stevens</artist> <country>UK</country> <company>Island</company> <price>8.90</price> <year>1990</year> </cd> <cd> <title>Stop</title> <artist>Sam Brown</artist> <country>UK</country> <company>A and M</company> <price>8.90</price> <year>1988</year> </cd> <cd> <title>Bridge of Spies</title> <artist>T`Pau</artist> <country>UK</country> <company>Siren</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Private Dancer</title> <artist>Tina Turner</artist> <country>UK</country> <company>Capitol</company> <price>8.90</price> <year>1983</year> </cd> <cd> <title>Midt om natten</title> <artist>Kim Larsen</artist> <country>EU</country> <company>Medley</company> <price>7.80</price> <year>1983</year> </cd> <cd> <title>Pavarotti Gala Concert</title> <artist>Luciano Pavarotti</artist> <country>UK</country> <company>DECCA</company> <price>9.90</price> <year>1991</year> </cd> <cd> <title>The dock of the bay</title> <artist>Otis Redding</artist> <country>USA</country> <company>Atlantic</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Picture book</title> <artist>Simply Red</artist> <country>EU</country> <company>Elektra</company> <price>7.20</price> <year>1985</year> </cd> <cd> <title>Red</title> <artist>The Communards</artist> <country>UK</country> <company>London</company> <price>7.80</price> <year>1987</year> </cd> <cd> <title>Unchain my heart</title> <artist>Joe Cocker</artist> <country>USA</country> <company>EMI</company> <price>8.20</price> <year>1987</year> </cd> </catalog> XSL File: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <input type="radio" name="Cost" value="1980" checked="checked" /> 1980 <input type="radio" name="Cost" value="1990" /> 1990 <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <xsl:if test="year>1990"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> <td><xsl:value-of select="year"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>

    Read the article

  • How can I convert convert docx or wordml xml files to xsl-fo?

    - by Jon Pastore
    I've been looking for a method to convert docx or wordml xml to xsl-fo. I read this post: http://stackoverflow.com/questions/156683/what-is-the-best-xslt-engine-for-perl but I'm having exceptional problems getting apache-fop going. I was able to download the bins and run it locally but the formatting was a little off and it didn't maintain the headers and footers or section 1 or section 3 (17 page doc 3 sections) it also overlapped the text over the outline numbers and did not maintain the font used. trying a more simple test caused fop to fail completely. I would like to find a way to create a PDF that is at least close to 100% accurate reproduction of the original doc.

    Read the article

  • XSLT generating attributes if source-Element is in parameterfile

    - by Siegfried
    Hi, i got an xml-file with some elements. For some of these is an aqvivalent in a parameter xml-file along with some other elements. I want to add these other elements from parm-file as parameter to output file if element-names are matching. (the Attributes should only be generated if an element "InvoiceHeader" exists in the source-xml. Here is my code... <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <xsl:variable name="rpl" select="document('ParamInvoice.xml')"></xsl:variable> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates></xsl:apply-templates> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:if test="$rpl/StoraInvoice/local-name()"> <xsl:call-template name="AttributeErzeugen"> <xsl:with-param name="attr" select="$rpl/StoraInvoice/local-name()"></xsl:with-param> </xsl:call-template> </xsl:if> <xsl:apply-templates></xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template name="AttributeErzeugen"> <xsl:param name="attr"></xsl:param> <xsl:for-each select="$attr"> <xsl:attribute name="{Attibute/@name}"><xsl:value-of select="."></xsl:value- of></xsl:attribute> </xsl:for-each> </xsl:template> </xsl:stylesheet> and here the param-file <?xml version="1.0" encoding="UTF-8"?> <StoraInvoice> <InvoiceHeader> <Attribute name="Fuehrend">YYY</Attribute> <Attribute name="Feld">FFFF</Attribute> <Attribute name="Format">XYZXYZ</Attribute> </InvoiceHeader> </StoraInvoice> Siegfried

    Read the article

  • Actual element tags are not getting captured.

    - by user323719
    I am using the below piece of XSL code to construct a span tag calling a javascript function on mouseover. The input to the javascipt should be a html table. The output from the variable "showContent" gives just the text content but not along with the table tags. How can this be resolved. XSL: <xsl:variable name="aTable" as="element()*"> <table border="0" cellspacing="0" cellpadding="0"> <xsl:for-each select="$capturedTags"> <tr><td><xsl:value-of select="node()" /></td></tr> </xsl:for-each> </table> </xsl:variable> <xsl:variable name="start" select='concat("Tip(&#39;", "")'></xsl:variable> <xsl:variable name="end" select='concat("&#39;)", "")'></xsl:variable> <xsl:variable name="showContent"> <xsl:value-of select='concat($start,$aTable,$end)'/> </xsl:variable> <span xmlns="http://www.w3.org/1999/xhtml" onmouseout="{$hideContent}" onmouseover="{$showContent}" id="{$textNodeId}"><xsl:value-of select="$textNode"></xsl:value-of></span> Actual Output: <span onmouseout="UnTip()" onmouseover="Tip('content1')" id="d1t14"is my </span Expected output: <span onmouseout="UnTip()" onmouseover="Tip('<table><tr><td>content1</td></tr>')" id="d1t14">is my </span> What is the change that needs to done in the above XSL for the table, tr and td tags to get passed?

    Read the article

  • Looping through all attributes of a XML element in XSLT

    - by TheGNUGuy
    Hey everyone, I am trying to use <xsl:for-each select="@*"> to grab all the attributes of a given element but when i do that my <xsl:choose> statement doesn't execute. Here is the element that I'm working with: <textBox id="Airfare" value="" label="text 1"/> Here is the XSLT template I'm using: <xsl:template match="textBox"> <div> <xsl:choose> <xsl:when test="@label"> <xsl:value-of select="@label"/> </xsl:when> <xsl:otherwise> <xsl:text>No Label Defined</xsl:text> </xsl:otherwise> </xsl:choose> <xsl:element name="input"> <xsl:attribute name="type">text</xsl:attribute> <xsl:for-each select="@*"> <xsl:choose> <xsl:when test="@id"> <xsl:attribute name="name">form_<xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="id">form_<xsl:value-of select="@id"/></xsl:attribute> </xsl:when> <xsl:when test="@label"> </xsl:when> <xsl:otherwise> <xsl:copy-of select="current()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:element> </div> And when I generate the HTML using PHP I get this: <div>text 1<input type="text" id="Airfare" value="" label="text 1"></div> As you can see it didn't add form_ to the id attribute it didn't generate a name attribute and it didn't skip over the label attribute. Thanks for your help!

    Read the article

  • Get current node's local-name in XSL

    - by green67
    Here's the structure of my XML <FileRoot> <UserSet1> <User> <FirstName></FirstName> <LastName></LastName> </User> <User> <FirstName></FirstName> <LastName></LastName> </User> ... </UserSet1> <InactiveUsers> <User> <FirstName></FirstName> <LastName></LastName> </User> <User> <FirstName></FirstName> <LastName></LastName> </User> ... </InactiveUsers> </FileRoot> In my XSL template <xsl:template match="/*/*"> <File> <xsl attribute name="Name"> <xsl:value-of select="local-name(/*/*)"/> </xsl:attribute> </File> </xsl> After transforming, for both UserSet1 and InactiveUsers, gave me "UserSet1". The expected results should be "UserSet1" for UserSet1, and "InactiveUsers" for InactiveUsers. How do I correctly retrieve the value? Thanks

    Read the article

  • xsltproc killed, out of memory

    - by David Parks
    I'm trying to split up a 13GB xml file into small ~50MB xml files with this XSLT style sheet. But this process kills xsltproc after I see it taking up over 1.7GB of memory (that's the total on the system). Is there any way to deal with huge XML files with xsltproc? Can I change my style sheet? Or should I use a different processor? Or am I just S.O.L.? <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:param name="block-size" select="75000"/> <xsl:template match="/"> <xsl:copy> <xsl:apply-templates select="mysqldump/database/table_data/row[position() mod $block-size = 1]" /> </xsl:copy> </xsl:template> <xsl:template match="row"> <exsl:document href="chunk-{position()}.xml"> <add> <xsl:for-each select=". | following-sibling::row[position() &lt; $block-size]" > <doc> <xsl:for-each select="field"> <field> <xsl:attribute name="name"><xsl:value-of select="./@name"/></xsl:attribute> <xsl:value-of select="."/> </field> <xsl:text>&#xa;</xsl:text> </xsl:for-each> </doc> </xsl:for-each> </add> </exsl:document> </xsl:template>

    Read the article

  • How to Generate XML from Database

    - by Nisarg Mehta
    Hi , I am fetching data from two tables CARRIER_IFTA ,IFTA_NAME. My Select Query is like below.. SELECT t1.IFTA_LICENSE_NUMBER,t1.IFTA_BASE_STATE,t2.NAME_TYPE,t2.NAME from CARRIER_IFTA t1 inner join IFTA_NAME t2 on t1.IFTA_LICENSE_NUMBER=t2.IFTA_LICENSE_NUMBER My Data is coming in this way... IFTA_LICENSE_NUMBER IFTA_BASE_STATE NAME_TYPE NAME -------------------------------------------------------- 630908333 US LG XYZ 630908333 US MG PQR 730908344 US LG ABC Now using XSLT I want to generate XML like this <T0019> <IFTA_ACCOUNT> <IFTA_LICENSE_NUMBER>630908333</IFTA_LICENSE_NUMBER> <IFTA_BASE_STATE>US</IFTA_BASE_STATE> <IFTA_NAME> <NAME_TYPE>LG<NAME_TYPE> <NAME>XYZ</NAME> </IFTA_NAME> <IFTA_NAME> <NAME_TYPE>MG<NAME_TYPE> <NAME>PQR</NAME> <IFTA_NAME> </IFTA_ACCOUNT> <IFTA_ACCOUNT> <IFTA_LICENSE_NUMBER>730908344</IFTA_LICENSE_NUMBER> <IFTA_BASE_STATE>US</IFTA_BASE_STATE> <IFTA_NAME> <NAME_TYPE>LG<NAME_TYPE> <NAME>ABC</NAME> </IFTA_NAME> </IFTA_ACCOUNT> </T0019> i have used below xslt but it is not giveng me desire result ... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/ROWSET"> <xsl:element name="T0019"> <xsl:apply-templates select="IFTAACCOUNT"/> </xsl:element> </xsl:template> <xsl:template match="IFTAACCOUNT"> <xsl:element name="IFTAACCOUNT"> <xsl:apply-templates select="IFTA_CARRIER_ID_NUMBER"/> </xsl:element> </xsl:template> <xsl:template match="IFTA_LICENSE_NUMBER"> <xsl:element name="IFTA_LICENSE_NUMBER"> <xsl:apply-templates /> </xsl:element> </xsl:template> <xsl:template match="IFTA_BASE_STATE"> <xsl:element name="IFTA_BASE_STATE"> <xsl:apply-templates /> </xsl:element> </xsl:template> <xsl:template match="IRP_NAME"> <IRP_NAME> <xsl:apply-templates select="NAME"/> <xsl:apply-templates select="NAME_TYPE"/> </IRP_NAME> </xsl:template> <xsl:template match="NAME"> <xsl:element name="NAME"> <xsl:value-of select="." /> </xsl:element> </xsl:template> <xsl:template match="NAME_TYPE"> <xsl:element name="NAME_TYPE"> <xsl:apply-templates /> </xsl:element> </xsl:template> </xsl:stylesheet> but it is not giving desire result ... Please help me ... Thanks in Advance...

    Read the article

  • Generate XML from Database using XSLT

    - by Nisarg Mehta
    Hi , I am fetching data from two tables CARRIER_IFTA ,IFTA_NAME. My Select Query is like below.. SELECT t1.IFTA_LICENSE_NUMBER,t1.IFTA_BASE_STATE,t2.NAME_TYPE,t2.NAME from CARRIER_IFTA t1 inner join IFTA_NAME t2 on t1.IFTA_LICENSE_NUMBER=t2.IFTA_LICENSE_NUMBER My Data is coming in this way... IFTA_LICENSE_NUMBER IFTA_BASE_STATE NAME_TYPE NAME -------------------------------------------------------- 630908333 US LG XYZ 630908333 US MG PQR 730908344 US LG ABC Now using XSLT I want to generate XML like this <T0019> <IFTA_ACCOUNT> <IFTA_LICENSE_NUMBER>630908333</IFTA_LICENSE_NUMBER> <IFTA_BASE_STATE>US</IFTA_BASE_STATE> <IFTA_NAME> <NAME_TYPE>LG<NAME_TYPE> <NAME>XYZ</NAME> </IFTA_NAME> <IFTA_NAME> <NAME_TYPE>MG<NAME_TYPE> <NAME>PQR</NAME> <IFTA_NAME> </IFTA_ACCOUNT> <IFTA_ACCOUNT> <IFTA_LICENSE_NUMBER>730908344</IFTA_LICENSE_NUMBER> <IFTA_BASE_STATE>US</IFTA_BASE_STATE> <IFTA_NAME> <NAME_TYPE>LG<NAME_TYPE> <NAME>ABC</NAME> </IFTA_NAME> </IFTA_ACCOUNT> </T0019> i have used below xslt but it is not giveng me desire result ... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/ROWSET"> <xsl:element name="T0019"> <xsl:apply-templates select="IFTAACCOUNT"/> </xsl:element> </xsl:template> <xsl:template match="IFTAACCOUNT"> <xsl:element name="IFTAACCOUNT"> <xsl:apply-templates select="IFTA_CARRIER_ID_NUMBER"/> </xsl:element> </xsl:template> <xsl:template match="IFTA_LICENSE_NUMBER"> <xsl:element name="IFTA_LICENSE_NUMBER"> <xsl:apply-templates /> </xsl:element> </xsl:template> <xsl:template match="IFTA_BASE_STATE"> <xsl:element name="IFTA_BASE_STATE"> <xsl:apply-templates /> </xsl:element> </xsl:template> <xsl:template match="IRP_NAME"> <IRP_NAME> <xsl:apply-templates select="NAME"/> <xsl:apply-templates select="NAME_TYPE"/> </IRP_NAME> </xsl:template> <xsl:template match="NAME"> <xsl:element name="NAME"> <xsl:value-of select="." /> </xsl:element> </xsl:template> <xsl:template match="NAME_TYPE"> <xsl:element name="NAME_TYPE"> <xsl:apply-templates /> </xsl:element> </xsl:template> </xsl:stylesheet> but it is not giving desire result ... Please help me ... Thanks in Advance...

    Read the article

  • XSL check param length

    - by AdRock
    I need to check if a param has got a value in it and if it has then do this line otherwise do this line. I've got it working whereas I don't get errors but it's not taking the right branch Here is the template which holds the html in the XSL stylesheet <xsl:call-template name="volunteer_role"> <xsl:with-param name="volrole" select="volunteer/roles" /> </xsl:call-template> and here is the template where there is a choice whether to take this brancg or that brach depending if the param is empty <xsl:template name="volunteer_role"> <xsl:param name="volrole" select="'Not Available'" /> <div class="small bold">ROLES:</div> <div class="large"> <xsl:choose> <xsl:when test="string-length($volrole)!=0"> <xsl:value-of select="$volrole" /> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> </div> </xsl:template>

    Read the article

  • Recoverable error while running XSL

    - by Kate
    XSL: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" exclude-result-prefixes="wp wne w10 w ve o r m v" version="2.0"> <xsl:output method="text"/> <xsl:param name="styleName"/> <xsl:template match="w:p"> <xsl:apply-templates/><xsl:text>&#10;</xsl:text> </xsl:template> <xsl:template match="w:r[not ((parent::w:hyperlink[@w:anchor[matches(.,concat('^(',$styleName,')')),'i']]))]"> <xsl:value-of select="replace(., '.', '&#xFF00;')"/> </xsl:template> </xsl:stylesheet> While processing the above XSL, I am getting the below error, Recoverable Error: Recoverable error on line 11 FORG0006: An error occurred matching pattern {w:r[not ((parent::w:hyperlink[@w:anchor[matches(.,concat('^(',$styleName,')')),'i']]))]}: Effective boolean value is not defined for a sequence of two or more items starting with a boolean Please Help. I am not able to figure out this.

    Read the article

  • placing the matched 2 different child elements xml values in a single line from xslt2.0

    - by Girikumar Mathivanan
    I have the below input xml, <GSKProductHierarchy> <GlobalBusinessIdentifier>ZGB001</GlobalBusinessIdentifier> <Hierarchy> <Material>335165140779</Material> <Level1>02</Level1> <Level2>02AQ</Level2> <Level3>02AQ006</Level3> <Level4>02AQ006309</Level4> <Level5>02AQ006309</Level5> <Level6>02AQ006309</Level6> <Level7>02AQ006309</Level7> <Level8>02AQ006309</Level8> </Hierarchy> <Hierarchy> <Material>335165140780</Material> <Level1>02</Level1> <Level2>02AQ</Level2> <Level3>02AQ006</Level3> <Level4>02AQ006309</Level4> <Level5>02AQ006309</Level5> <Level6>02AQ006309</Level6> <Level7>02AQ006309</Level7> <Level8>02AQ006310</Level8> </Hierarchy> <Texts> <ProductHierarchy>02AQ006310</ProductHierarchy> <Language>A</Language> <Description>CREAM</Description> </Texts> <Texts> <ProductHierarchy>02AQ006309</ProductHierarchy> <Language>B</Language> <Description>CREAM</Description> </Texts> as per the requirement, xsl should check the matched value of GSKProductHierarchy/Hierarchy/Level8 in the GSKProductHierarchy/Texts/ProductHierarchy elements...and its should result as below flat file. 335165140779|02|02AQ|02AQ006|02AQ006309|02AQ006309|02AQ006309|02AQ006309|02AQ006309|02AQ006309|A|CREAM| 335165140780|02|02AQ|02AQ006|02AQ006309|02AQ006309|02AQ006309|02AQ006309|02AQ006310|02AQ006310|B|CREAM| Right now I have the below xslt, <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:set="http://exslt.org/sets" xmlns:str="http://exslt.org/strings" xmlns:java="http://xml.apache.org/xslt/java" xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="exsl set str java saxon"> <xsl:output method="text" indent="yes"/> <xsl:variable name="VarPipe" select="'|'"/> <xsl:variable name="VarBreak" select="'&#xa;'"/> <xsl:template match="/"> <xsl:for-each select="GSKProductHierarchy/Hierarchy"> <xsl:variable name="currentIndex" select="position()"/> <xsl:variable name="Level8" select="Level8"/> <xsl:variable name="ProductHierarchy" select="../Texts[$currentIndex]/ProductHierarchy"/> <xsl:if test="$Level8=$ProductHierarchy"> <xsl:value-of select="Material"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level1"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level2"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level3"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level4"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level5"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level6"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level7"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="Level8"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="../Texts[$currentIndex]/ProductHierarchy"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="../Texts[$currentIndex]/Language"/> <xsl:value-of select="$VarPipe"/> <xsl:value-of select="../Texts[$currentIndex]/Description"/> <xsl:value-of select="$VarPipe"/> <xsl:if test="not(position() = last())"> <xsl:value-of select="$VarBreak"/> </xsl:if> </xsl:if> </xsl:for-each> </xsl:template> can anyone please suggest what function should i need to use to get the desired result. Regards, Giri

    Read the article

  • how to get child nodes in xsl

    - by ppp
    here my code- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="ArrayOfLinkEntity" name="bindLink"> <ul> <xsl:for-each select="LinkEntity[ParentLinkId=0]"> <li> <xsl:variable name="linkId" select="LinkId"/> <xsl:variable name="child" select="count(/ArrayOfLinkEntity/LinkEntity[ParentLinkId=$linkId])"/> <xsl:value-of select="$child"/> <xsl:choose> <xsl:when test="($child &gt; 0)"> <a href="#" data-flexmenu="flexmenu1" onclick="javascript:setPageLinkId({$linkId});"> <xsl:value-of select="LinkTitle"/> <img src="../images/down.gif" border="0"/> </a> </xsl:when> <xsl:otherwise > <a href="#" onclick="javascript:setPageLinkId({$linkId});"> <xsl:value-of select="LinkTitle"/> </a> </xsl:otherwise> </xsl:choose> </li> </xsl:for-each> </ul> </xsl:template> </xsl:stylesheet> but I am getting $child=0 always.but there exists children. my xml structure- <ArrayOfLinkEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <LinkEntity> <EntityId>00000000-0000-0000-0000-000000000000</EntityId> <LinkId>1</LinkId> <SequenceNo>1</SequenceNo> <ParentLinkId>0</ParentLinkId> <LinkTitle>Home</LinkTitle> <SubLink /> </LinkEntity> ... </ArrayOfLinkEntity> What should I do? Please suggest.

    Read the article

  • XSL file handling through javascript

    - by Zaid Iqbal
    i want to handle my xsl file through my javascript code. I made my XSL file but i want to dynamically change my XSL file at run time.As in add more attributes in header or data. My javascript code as follow` <script> function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(""); return xhttp.responseXML; } function displayResult() { xml=loadXMLDoc("cdcatalog.xml"); xsl=loadXMLDoc("cdcatalog.xsl"); // code for IE if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("example").appendChild(resultDocument); } } </script> My XSL file code: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> <th align="left">Country</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> <td><xsl:value-of select="country" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> `

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >