I just want to ask what this code practically means?

<xsl:variable name="gSetValues" select="toolPackage:setValues($obDateFormat,$gDocID)"/>

<xsl:variable name="gSmi" select="normalize-space(toolPackage:PubMetaDataReader.getEntry($gKey, 'smi'))"/>

<xsl:variable name="obDateFormat" select="toolPackage:LNDateFormat.new('<input format date>', '<output format date>', 'ENGLISH', 'German', '19000101', '365', '19000101')"/>

<xsl:variable name="vFormattedLoadDate"  select="toolPackage:reformat($obLoadDateFormat,$gLoadDate,$gDocID)"/>

I don't understand the 'totalPackage' followed by setValues,LNDateFormat,PubMetaDataReader.getEntry,reformat ?

How can I connect each different 3 XML file in one XSLT..because some xml file needed is in the other xml files with one match only e.g <ARTICLE> <- the root element? The other file is the roadmap.xml and pubmeta.xml

After making an XML, it is need to do a roadmap file and dtd to proceed in XSLT?

Second

XML file

<data>
 <subject dc="element1">
   <category>News</category>
 </subject>

 <subject dc=element1">Television</subject>
 <subject dc=element1">Celebrity</subject>
 <subject dc=element1">Foreign Affairs</subject>
 <subject dc=element1">Movies</subject>
</data>

How can I enclose each content of <subject></subject> with <term></term> that is multiple subject? and strip-off the attributes.. ?

expected output

<lnv:SUBJECT>
  <term>Television</term>
  <term>Celebrity</term>
  <term>Foreign Affairs</term>
  <term>Movies</term>
</lnv:SUBJECT>

Recommended Answers

All 7 Replies

Please help me, I don't understand what toolPackage....where it came from and my stuck...thanks

You are using an add-xsl package
This is in imported xslt and a namespace defined

such exsl

http://www.exslt.org/howto.html

this also means that is only with the parser to load the package
that has nothing but no effect for three xml file

second

use xsl

xml

<?xml version="1.0"?>
<data>
	<subject dc="element1">
		<category>News</category>
	</subject>
	<subject dc="element1">Television</subject>
	<subject dc="element1">Celebrity</subject>
	<subject dc="element1">Foreign Affairs</subject>
	<subject dc="element1">Movies</subject>
</data>

xml in the origin, 5 are subject nodes
one subject has a further child node category

this should not appear in the result xml
also required is the namespace in the result xml

Provide as well as the mechanism NameSpace

xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
	<xsl:template match="/">
		<lnv:SUBJECT xmlns:lnv="http://my.de/lnv">
			<xsl:apply-templates select="data"/>
		</lnv:SUBJECT>
	</xsl:template>
	<xsl:template match="data">
		<xsl:apply-templates select="subject[not(child::*)]"/>
	</xsl:template>
	<xsl:template match="subject">
		<term>
			<xsl:value-of select="."/>
		</term>
	</xsl:template>
</xsl:stylesheet>

result

<?xml version='1.0' ?>
<lnv:SUBJECT xmlns:lnv="http://my.de/lnv">
  <term>Television</term>
  <term>Celebrity</term>
  <term>Foreign Affairs</term>
  <term>Movies</term>
</lnv:SUBJECT>

question what xmlns:lnv="http://my.de/lnv" means ?I know inside the "" is a namespace but what is the purpose and what is xmlns:lnv? and the like of xmlns:lnvni, xmlns:lnlit, xmlns:lnclx, xmlns:lncle,xmlns:lndocmeta and can you recommend a books or site about xml and xslt...and editor to make xslt..thank you very much.

xmlns: lnv = "http://my.de/lnv"
xmlns => attribute in the day by all the following day are also found in the namespace
lnv => then the namespace designated
"....." is> = as in java only one variable pointing when something is about to find some kind of description

namespace is an aid to his XML to protect area
examples
xs or xsd schema there all day then xsd: As described at the beginning
xsl the same xs

http://en.wikipedia.org/wiki/XML_namespace

http://en.wikipedia.org/wiki/Namespace

here are much too find mystery
http://www.w3schools.com/xml/xml_namespaces.asp

Question again how Can I only get the VR character from this xml code

<article>
 <metadata>
   <identifier xmlns:dcterms="http://purl.org/dc/elements/1.1/">VR-011-7440-7_2</identifier>
 </metadata>
</article>

THE XSLT

<xsl:template match="article">
<xsl:call-template name="JOURNAL-CODE"/> <!--these where to put the VR-->

<xsl:template name="JOURNAL-CODE">
    <xsl:element name="lnv:JOURNAL-CODE">
	    <xsl:value-of select="substring-before("article/metadata/identifier",'-')"/>
    </xsl:element>
</xsl:template>

I tried to run it but it has error....I don't know if I'm doing the right thing in using the substring... thank you again

identifier lives in namespace dcterms:
define in stylesheet the namespace
and use in select
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dcterms="http://purl.org/dc/elements/1.1/">

<xsl:template match="article">
<xsl:call-template name="JOURNAL-CODE"/> <!--these where to put the VR-->
</xsl:template>
<xsl:template name="JOURNAL-CODE">
<xsl:element name="lnv:JOURNAL-CODE">
<xsl:value-of select="substring-before("article/metadata/dcterms:identifier",'-')"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.