It's not a secret anymore!*
The moose likes XML and Related Technologies and the fly likes xsl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl" Watch "xsl" New topic
Author

xsl

Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
please analyze this code and what it doing
***insertPropertiesTag.xsl *****
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" xmlns:saxon="http://icl.com/saxon" saxon:trace="no" extension-element-prefixes="saxon">
<xsl:param name="base-path" />
<xsl:param name="mdx-properties-file" />
<xsl:variable name="mdx-properties-root" select="document($mdx-properties-file)" />
- <xsl:template match="Catalog">
- <xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
- <xsl:template match="MetadataTypeData">
<xsl:apply-templates select="MetadataItemData" />
</xsl:template>
- <xsl:template match="MetadataItemData">
<xsl:apply-templates />
</xsl:template>
- <xsl:template match="Name">
- <property>
- <name>
<xsl:value-of select="." />
</name>
- <value>
<xsl:value-of select="following-sibling::node()" />
</value>
</property>
</xsl:template>
<xsl:template match="Value" />
- <xsl:template match="caseId">
- <xsl:copy>
<xsl:value-of select="." />
</xsl:copy>
</xsl:template>
- <xsl:template match="documentSet">
- <xsl:copy>
- <xsl:for-each select="./*">
- <xsl:choose>
- <xsl:when test="name() = 'documents'">
- <xsl:copy>
- <xsl:for-each select="./document">
<xsl:variable name="path-name" select="concat($base-path , relativePath , '\',fileName)" />
<xsl:variable name="mdx-document-root" select="$mdx-properties-root/Root/DocumentData[Document = $path-name]" />
- <xsl:copy>
- <xsl:for-each select="./*">
- <xsl:choose>
- <xsl:when test="name() = 'emailMeta'">
<xsl:copy-of select="." />
</xsl:when>
- <xsl:when test="name() = 'properties'">
- <xsl:copy>
- <xsl:if test="../duplicate = 'false'">
<xsl:apply-templates select="$mdx-document-root/MetadataTypeData" />
</xsl:if>
</xsl:copy>
</xsl:when>
- <xsltherwise>
- <xsl:copy>
<xsl:value-of select="." />
</xsl:copy>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
<properties />
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:when>
- <xsl therwise>
- <xsl:copy>
<xsl:value-of select="." />
</xsl:copy>
</xsl therwise>
</xsl:choose>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


command line argument-->
com.icl.saxon.StyleSheet
-o PCatalog.xml catalog.xml
./insertPropertiesTag.xsl
base-path=G:\Projects\SEDT\TestFolder\420\matched
mdx-properties-file=./wordMeta.xml

wordMeta.xml is a metadata file. thanks in advance




Edit Comment: Disabled smiles in this post.

- m
[ December 24, 2004: Message edited by: Madhav Lakkapragada ]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
please analyze this code and what it doing

If I am not missing anything, this code represents a style sheet to convert some xml into some other xml file.

Is that analysis correct or am I missing the point ?

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
yes Madhav you are correct.but it not giving the expected results where i am going wrong?can you please point out.thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
What exactly is this transformation doing differently from what you expect?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
i got the problem it is in
<xsl:variable name="mdx-document-root"
select="$mdx-properties-root/Root/DocumentData[Document = $path-name]"/>

run time values are
path-name=>c:\input\matched\xyz.doc
<Document>C:\INPUT\matched\xyz.doc</Document>

is there any way so that i can able to do a caseinsensitive comparison between these two variables?
Manoj Raghuwanshi
Ranch Hand

Joined: Jun 20, 2004
Posts: 75
Lasse you read a lot of books.I go through your amazone review link.you are great.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Originally posted by Manoj Raghuwanshi:

is there any way so that i can able to do a caseinsensitive comparison between these two variables?


ummm....nope! XML, by nature is case sensitive.
The work around I use is to translate every thing to one case (either lower or upper) and then do the comparision on the resulting translated string.

That's one way to do a case-insensitive (well practically speaking) comparision.

- m
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: xsl
 
Similar Threads
XSLT value-of parameter not works as xml value
XSLT merging help
Passing an XPath Param value
Replicate XML Node using XSL
xsl:if and XPath