- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
11 Posted Topics
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/para"> <p> <xsl:value-of select="text()[1]"/> <xsl:apply-templates select="i"></xsl:apply-templates> <xsl:value-of select="text()[2]"/> </p> <xsl:apply-templates select="formula"></xsl:apply-templates> <p> <xsl:value-of select="text()[3]"/> </p> </xsl:template> <xsl:template match="node()"><xsl:copy-of select="."/></xsl:template> <xsl:template match="formula"> <p class="formula"> <img src="{concat(@altimg,'.png')}" alt="{.}" /> </p> </xsl:template> </xsl:stylesheet>
[CODE]<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/Vehicles"> <Vehicles> <xsl:for-each select="Company[not(@name = following-sibling::Company/@name)]"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:variable name="name" select="@name"></xsl:variable> <xsl:for-each select="/Vehicles/Company[@name = $name]"> <xsl:copy-of select="Vehicletype"/> </xsl:for-each> </xsl:copy> </xsl:for-each> </Vehicles> </xsl:template> </xsl:stylesheet>[/CODE]
all well formed xml documents need a root node. You have two elements at the top level, you can only have one
hi, you need something like this: [CODE]<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xd" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <root> <xsl:for-each select="root/ELEC01_SOWaitingParts3[not(JobOper_JobNum = preceding::JobOper_JobNum)]"> <xsl:copy-of select="."/> </xsl:for-each> </root> </xsl:template> </xsl:stylesheet>[/CODE] Cheers, John Bampton.
maybe line 23 and 24 are causing problems...
i not and not sure what you are after. It is hard to understand. But I notice that your code is very verbose. for example <xsl:element name="pri:partnerIdentity"></xsl:element> can be written as <pri:partnerIdentity></pri:partnerIdentity>
[CODE] <xsl:template match="comment()"> <xsl:if test="contains(.,'Text which need to remove')"><xsl:comment>asdf</xsl:comment> </xsl:if> </xsl:template>[/CODE]
Here's the first bit. You should be able to do the second bit by copy and paste. [CODE]<?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" version="2.0"> <xsl:template match="/"> <field name="InterPro"> <xsl:for-each select="tokenize(GBSeq_source-db,'InterPro:')"> <xsl:choose> <xsl:when test="position() != 1"> <xsl:value-of select="substring-before(.,',')"/> <xsl:text> </xsl:text> </xsl:when> </xsl:choose> </xsl:for-each> </field> </xsl:template> </xsl:stylesheet>[/CODE] Cheers, John Bampton
Hi, simple! [CODE]<?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" version="2.0"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/"> <aliases> <xsl:for-each select="tokenize(substring-after(GBSeq_definition,'AltName:'),';')"> <xsl:for-each select="tokenize(.,'=')"> <xsl:if test="position() > 1"> <xsl:value-of select="normalize-space(.)"/> <xsl:text>; </xsl:text> </xsl:if> </xsl:for-each> </xsl:for-each> </aliases> </xsl:template> </xsl:stylesheet>[/CODE] Cheers, John Bampton.
You need something like this: [CODE]<?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" version="1.0"> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="FinancialNumber"> <xsl:copy> <xsl:number value="." format="00001"/> </xsl:copy> </xsl:template> </xsl:stylesheet>[/CODE] Cheers, John Bampton
you need to provide some sample inputs and sample outputs. Otherwise it's a bit hard to understand what you need.
The End.
JohnBampton